Search and Top Navigation
#15242 closed bug (notabug)
Opened September 25, 2017 02:50AM UTC
Closed September 25, 2017 10:39AM UTC
Last modified September 25, 2017 01:23PM UTC
Doesn't apply names to autocomplete/combobox elements, therefore will only validate first one
Reported by: | sbaker7 | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | none |
Component: | ui.autocomplete | Version: | 1.12.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi there,
Tested even on the demos on the jqueryui site; because no name is applied to the input field for the autocomplete, if there are multiple autocompletes in a form, it will only validate the first one. Needs to apply either id or name of the parent field to the input so it will validate more than one input box.
Attachments (0)
Change History (5)
Changed September 25, 2017 10:39AM UTC by comment:1
resolution: | → notabug |
---|---|
status: | new → closed |
Changed September 25, 2017 11:10AM UTC by comment:2
This actually prevents most validation libraries, including jquery validate and correct HTML5 validation. The validation itself is not the bug in terms of jquery-ui, it’s the fact they are unvalidateable because they are not named that causes the issue that needs to be fixed.
Changed September 25, 2017 11:18AM UTC by comment:3
I'm not sure what you're not understanding. You are responsible for giving the element a name. You mentioned the examples on the jQuery UI site, but it's very clear that the widget is not generating the input elements and any attributes at all could be placed in the markup.
If you need more help, please use Stack Overflow, IRC, or the forums.
Changed September 25, 2017 01:19PM UTC by comment:4
Would you not agree that a name should work in the same name as an id? I’d debate further about how I think the fact I need to copy over all of my attributes on the select manually is tedious and ridiculous, but I feel like name is a particular stand out, particularly as autocomplete is a FORM element and the name field is what specifies the field should be returned as upon submission. That’s without mentioning that it breaks validation requirements and affects accessibility with some tools. Sure, you can ask everyone to manually reset the value you’ve already set on the select anyway, but wouldn’t it make more sense and be more user friendly to copy it? Unless someone is using some obscure custom data attribute, I don’t understand the implementation decision that was made to not carry over the attributes from the data source (in this case a select box) when the reality is that I and I’m sure many others are just going to run a method after to copy all of these fields over anyway instead of writing the same junk in my JS to do something that should have been built in in the first place. All I can think of is this is another half-baked solution that expects the use to do pretty much the entirety of the work anyway.
But I digress; the name field is a vital, identifying attribute on the input element and therefore I disagree with the current ‘work-around/DIY’ style solution and think that it should be treated like the id attribute, therefore nullifying a number of larger issues due to the dependencies on this field with current common design patterns. This is where the particular issue lies that I am discussing. I understand the current implementation, I’ve crawled through the entire library and rebuilt large portions of it to add basic expected functionality. The issue here lies in the fact this library does not correctly fulfil basic and essential requirements for even very simplistic use cases and I think that should be changed.
Changed September 25, 2017 01:23PM UTC by comment:5
I’d debate further about how I think the fact I need to copy over all of my attributes on the select manually is tedious and ridiculous
I have no idea what you're referring to. Autocomplete works on text fields, it does nothing with select elements. Please use Stack Overflow, IRC, or the forums to figure out which components you are actually using. Minimal code examples go a long way.
I'm really not sure what you're referring to. Autocomplete doesn't do any validation and the input field is created by you, not the widget. If you're using the constructor directly and letting the default element get created, then it's still your responsibility to apply a
name
after the element has been created.