Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.0.0.-rc04 - Select2 uses invalid input name #14098

Closed
jprodriguez-nbs opened this issue Sep 22, 2022 · 1 comment
Closed

6.0.0.-rc04 - Select2 uses invalid input name #14098

jprodriguez-nbs opened this issue Sep 22, 2022 · 1 comment
Assignees
Milestone

Comments

@jprodriguez-nbs
Copy link

With the following html to use select

<select asp-for="GetListDto.Calca"
                                class="auto-complete-select"
                                data-autocomplete-api-url="/api/app/vehicle?sorting=&skipCount=0&maxResultCount=100"
                                data-autocomplete-display-property="calca"
                                data-autocomplete-value-property="calca"
                                data-autocomplete-items-property="items"
                                data-autocomplete-filter-param-name="keyword">

                        </select>

we obtain the following html once rendered

<input type="hidden" id="GetListDto.Calc_Text]" name="GetListDto.Calc_Text]">

dom-event-handlers.js initialises autocomplete selects with abp.dom.initializers.initializeAutocompleteSelects
This function defines a hidden text input to store the selection:

var selectedTextInputName = name.substring(0, name.length - 1) + "_Text]";
                var selectedTextInput = $('<input>', {
                    type: 'hidden',
                    id: selectedTextInputName,
                    name: selectedTextInputName,
                });

The calculated selectedTextInputName produces the identifiers and names found in the rendered html:

<input type="hidden" id="GetListDto.Calc_Text]" name="GetListDto.Calc_Text]">

The id and name should be the name provided in the cshtml file, GetListDto.Calca

The same happens if we use abp-select tag:

                        <abp-select asp-for="GetListDto.Calca"
                                class="auto-complete-select"
                                id="filter_select_calca",
                                autocomplete-api-url="/api/app/vehicle?sorting=&skipCount=0&maxResultCount=10000"
                                autocomplete-display-property-name="calca"
                                    autocomplete-value-property-name="calca"
                                    autocomplete-items-property-name="items"
                                autocomplete-filter-param-name="keyword">

                        </abp-select>
@enisn
Copy link
Member

enisn commented Oct 26, 2022

Closed by #14448
It'll be released in the next patch version (6.0.1)

@enisn enisn closed this as completed Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants