Search and Top Navigation
#9570 closed bug (duplicate)
Opened September 24, 2013 02:23PM UTC
Closed September 24, 2013 02:24PM UTC
Error on radio and non-radio input sharing a name
Reported by: | ardoramor | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | none |
Component: | ui.button | Version: | 1.9.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
For the purposes of my development, I have a case where my form has a series of radio buttons and an input type="text" with the same name. The issue comes in when toggling one of the radio buttons. The code uses a function ''radioGroup'' only for radio buttons but does not ensure that it only selects radios:
radioGroup = function( radio ) { var name = radio.name, form = radio.form, radios = $( [] ); if ( name ) { if ( form ) { radios = $( form ).find( "[name='" + name + "']" ); } else { radios = $( "[name='" + name + "']", radio.ownerDocument ) .filter(function() { return !this.form; }); } } return radios; };
The result is the following uncaught exception: ''Uncaught Error: cannot call methods on button prior to initialization; attempted to call method 'widget'.''
The change should be the addition of ''[type="radio"]'' as follows:
radios = $( form ).find( "[name='" + name + "'][type='radio']" );
radios = $( "[name='" + name + "'][type='radio']", radio.ownerDocument )
HTML spec does not forbid assigning the same name to inputs. These inputs will be serialized. As such, jQueryUI should handle such case appropriately and only attempt to apply modifications to proper elements.
Attachments (0)
Change History (1)
Changed September 24, 2013 02:24PM UTC by comment:1
resolution: | → duplicate |
---|---|
status: | new → closed |
Duplicate of #9386.