Skip to content

WComponents null selection

Mark Reeves edited this page Dec 28, 2017 · 7 revisions

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.

Implicit null selection

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.

Selection components which support implicit null selection

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.

Selection components which never support implicit null selection

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.

Indeterminate selection with radio buttons

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 using SHIFT+TAB) will not be selected and the next TAB/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:

and

Related components

Clone this wiki locally