Button: Non-button elements with the same name as a radio cause an exception
|Reported by:||reubenhelms||Owned by:|
My jsFiddle example is here http://jsfiddle.net/reubenhelms/ZtZu8/
This shows a radio set in a div that is formatted by buttonset() on a div. It also shows a hidden field that shares the same name as the radio set, but is outside the div targeted by the radio set.
Hidden fields often accompany a radio or checkbox field to send a value to the server, to denote the field exists, but nothing was selected.
When selecting an option in the radio set, a console error is generated "Uncaught Error: cannot call methods on button prior to initialization; attempted to call method 'widget'.
This error occurs because radioGroup() picks up all elements in a form that share the same name as the selected radio button, and then assumes that all items have associated buttons.
Restricting elements to the same type as the selected radio button, or restricting elements to the div of the original buttonset target would prevent this error, and allow the usage of hidden fields to denote an unselected buttonset.
Change History (13)
comment:10 Changed 3 years ago by
|Milestone:||1.10.0 → none|
|Status:||closed → reopened|
|Summary:||click of a button in a buttonset console errors on elements not a part of the button set → Button: console errors on elements not a part of the button set|
comment:11 Changed 3 years ago by
|Status:||reopened → open|
|Summary:||Button: console errors on elements not a part of the button set → Button: Non-button elements with the same name as a radio cause an exception|