-
Notifications
You must be signed in to change notification settings - Fork 17
WComponents null selection
Several data input components provide a means to select one or more options from a list. Some of these provide a way for the user to implicitly make no selection: that is, if no options are selected by default and the user does not interact with the control then no selection is implied. Others do not support this notion of "implicit null selection". This is an important consideration when deciding which selection control is appropriate for a given situation.
This term applies to WComponents which are used to select from a set of options and in which no option is set as selected by the server before the user interacts with the form. If a component supports implicit null selection then if the user does not explicitly select an option before submitting the form no option will be returned as the selected option.
If any of these components is delivered to the user with no option selected and the user does not make a selection or interact with the component in any way then no option will be returned as selected.
If any of these components is delivered to the user with no option selected and the user does not make a selection or interact with the component in any way then the first option will be returned as the selected option.
WRadioButtonSelect and a group of WRadioButton components pose a particular problem in the case where no option (or no WRadioButton in the group) is selected on page load.
- If the user does not interact with the radio buttons in any way then no option will be returned to the server as selected;
- If the user undertakes no action which will result in any one radio button being selected then no option will be returned to the server as selected;
- If the user uses the keyboard to focus one radio button in the group by way of the
TAB
key then that radio button (which will generally be the first in the group if entering from an element earlier in source order or the last if entering from an element later in source order usingSHIFT+TAB
) will not be selected and the nextTAB
/SHIFT+TAB
will leave the group without making a selection and no option will be returned to the server as selected; - If the user focuses a radio button in the group as outlined above but then proceeds to navigate through the group using the arrow keys then each arrow key press will focus and select the next/previous radio button in the group, and once a selection has been made it is not possible to return to the state of having no selection;
- If the user uses the keyboard to focus a radio button in the group by using an access key then the first radio button in the group will receive focus and it will be selected, and once a selection has been made it is not possible to return to the state of having no selection.
Given that a radio button may be accidentally selected by using the arrow keys or an access key, and that once a radio button has been selected there is no way for the user to return to the state of having no radio buttons selected, it is a requirement that either:
- a WRadioButtonSelect must always have a default selected option; or
- a WRadioButtonSelect may have no options selected by default if it is mandatory;
and
- any group of WRadioButtons must always have exactly one WRadioButton selected by default; or
- any group of WRadioButtons may have no WRadioButton selected by default if the RadioButtonGroup is mandatory.