#6420 closed defect (fixed)
Form: getValues() ignores radio sets with no radio selected
Reported by: | Owned by: | Douglas Hays | |
---|---|---|---|
Priority: | low | Milestone: | 1.3 |
Component: | Dijit - Form | Version: | 1.1.0 |
Keywords: | getValues() Form Radio dijit.form.Radio dijit.form.Form | Cc: | bill |
Blocked By: | Blocking: |
Description
If a dijit.form.Form contains a set of radios but none are selected getValues() does not list the radio set. getValues() should have an entry with the name of the radio set and a value of false or null.
On a related note, make sure setValues() with a radio value of null/false unselects all the radios.
Change History (10)
comment:1 Changed 13 years ago by
Cc: | [email protected]… removed |
---|---|
Milestone: | 1.1.1 → 1.3 |
Owner: | set to bill |
Reporter: | changed from guest to [email protected]… |
Summary: | dijit.form.Form.getValues() ignores radio sets with no radio selected → Form: getValues() ignores radio sets with no radio selected |
comment:2 Changed 12 years ago by
Owner: | changed from bill to Douglas Hays |
---|---|
Status: | new → assigned |
comment:3 Changed 12 years ago by
This is correct behaviour for a set of radio buttons. Not a bug... try it with a regular (not Dojo) form; nothing is reported for a radio button set unless a value is selected. On the other hand, one of the values is always supposed to be selected, and it's the responsibility of the person writing the page. See http://www.w3.org/TR/html401/interact/forms.html.
Perhaps the Dijit RadioButton? logic should ensure the first button is checked if not specified in the page? That's the proper behaviour.
comment:4 Changed 12 years ago by
This ticket isn't about the behavior of radio buttons, it's about the behavior of the Form widget (dijit.Form), and it's not about what gets submitted with a <form>, it's about the return value of dijit.form.form.getValues(). getValues() should return an empty array, as per the spec of the dijit.form.Form widget. Admittedly that's an arbitrary choice.
As per the HTML spec listed above, http://www.w3.org/TR/html401/interact/forms.html#h-17.6.1, it says that "Zero or more choices may be pre-selected for the user.", so it doesn't necessarily need to be selected.
comment:5 Changed 12 years ago by
Radio button is not an "option" (i.e., child of "select"), it's an "input" of type "radio". Section 17.6 does not apply to radio buttons, Section 17.2 does. Radio button groups are supposed to have one radio button selected at all times. They're not optional; that's what "select" is for, where (as you noted) you are allowed a "null" option.
That's why the spec says "since some browsers are broken, make sure you select a default manually."
comment:6 Changed 12 years ago by
Oops, yah I misread that. Actually I got confused and thought this ticket was about a group of checkboxes, all unchecked.
Well, I'm not quite ready to punt and make developers indicate an initially selected radio, but maybe I'll change my mind. Will think about it after 1.2.
comment:7 Changed 12 years ago by
Cc: | bill added |
---|
bill, I need to know if you want the RadioButton? widget to always force 1 to be checked, or if you want the Form widget to use null for an all-unselected radio group.
comment:8 Changed 12 years ago by
OK, please use a null for an all-unselected radio group. As you said on chat that will make setValues(getValues()) work correctly.
comment:9 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:10 Changed 10 years ago by
Component: | Dijit → Dijit - Form |
---|
Yup, this sounds like a bug.