For checkboxes, the best way is probably to pre-select it and disable it. I'm just joking.
To select one switch in a group, either start with the default selection, or do a test using javascript. There are no HTML methods for this, because all possible options are valid.
In html5 there is a required flag for flags.
They are somehow strange, so let me give you something to explain how they work.
For flags, the required attribute should only be executed when one or more flags with this name are checked in this form.
For a radio button, the required attribute should be executed only when one of the switches in this radio group is set.
Of course, you should always check the server side, because the client can always send you everything he wants. Just use these methods for the best user experience.
The Surrican Feb 04 '11 at 18:56 2011-02-04 18:56
source share