Enforce comformance to W3C recommendations on radio buttons?

Created on 2 November 2009, almost 15 years ago
Updated 26 June 2023, about 1 year ago

Spill-over from #569542: Button Option Field is Required, has One Option - Select that Option β†’ and #368771-24: Create Documentation about removing N/A option for not required radio buttons β†’ :

From http://www.w3.org/TR/html401/interact/forms.html#h-17.2.1 (I tried to find an XHTML version of this section, and failed):

If no radio button in a set sharing the same control name is initially "on", user agent behavior for choosing which control is initially "on" is undefined. [snip] Since user agent behavior differs, authors should ensure that in each set of radio buttons that one is initially "on".

See also http://www.ietf.org/rfc/rfc1866.txt

The recommendation is basically saying that there should never be a situation where radio buttons appear that do not have one of the options pre-selected. Mainly, I guess, because you can never "un" select one of the options in a list of radios once you click into it. If you want a control where users have to explicitly choose something, you should use a select box instead which can have a 'neutral' option.

What CCK (and presumably Field UI) does is, for required fields, always select the first one in the list. For non-required fields, it automatically creates an "N/A" option to give people the ability to not fill out the field.

Basically, I guess the question is... should Form API enforce this recommendation, and disallow radio button controls without a #default_value (probably defaulting to the first option if none is selected)? People who still wanted "N/A" as one of the choices could still add it in there as one of the $options.

Anyone here web a standards geek?

πŸ“Œ Task
Status

Postponed: needs info

Version

9.5

Component
FormΒ  β†’

Last updated less than a minute ago

Created by

πŸ‡¨πŸ‡¦Canada webchick Vancouver πŸ‡¨πŸ‡¦

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024