When applied to a fieldset, the required attribute would indicate that all form fields within the set were required.
This would be particularly useful when a choice was required from a set of radio buttons.
Clarification: If the fieldset encloses radio buttons, one of them must be checked. If the fieldset encloses checkoxes, one or more of them must be checked. If the fieldset encloses other fields, all of them are required. Basically, every unique field name enclosed by the fieldset must have a value.
> This would be particularly useful when a choice was required from a set of
> radio buttons.
Why? If @required is set on _any_ radio button in the set, then the entire set is required (in the sense that one of the radio buttons must be selected for the form to submit). It doesn't have to be the one with the @required attribute on it.
Would the way radiobuttons work with the required attribute also work with checkboxes? Suppose you have a group of checkboxes from which the user is required to select at least one? Wouldn't the required attribute be more flexible on the fieldset?
As a sidenote: I never understood why there had to be both a checkbox and a radiobutton. Perhaps a bit off-topic, but please consider:
1) a checkbox without a parent fieldset would be just a single checkbox.
2) A group of checkboxes in a fieldset with multiple=false would be a group of radiobuttons
3) A group of checkboxes in a fieldset with multiple=true would be a group of checkboxes
4) If fieldset has required set then at least 1 choice must be made from the checkboxes.
5) optionally: required=x where x is an integer denoting the amount of choices the user must make minimally.
All this would be backward compatible (or could at least be made so).
> Would the way radiobuttons work with the required attribute also work with
> Suppose you have a group of checkboxes from which the user is
> required to select at least one?
That's basically what <select multiple required> gives you. I agree that having a way to do that with checkboxes would be good, but I don't see why it should depend on fieldsets....
> I agree that
> having a way to do that with checkboxes would be good, but I don't see why it
> should depend on fieldsets....
I am not saying it should. It is just a proposal using what we have in a non-conflicting way (as far as I can see).
I agree with you that select gives us the functional ability and in hindsight it would have been better if radiobuttons, checkboxes and selectboxes would have been condensed into 1 element, but that is not how it is. Add to that the inability of browsers to let us restyle form elements any way we want in an easy and consitent way and I think a bit more flexibility in how we can use fieldsets and checkboxes would go a long way.
But I may be a minority, I do not know.
This bug was cloned to create bug 17827 as part of operation convergence.
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are
satisfied with this response, please change the state of this bug to CLOSED. If
you have additional information and would like the editor to reconsider, please
reopen this bug. If you would like to escalate the issue to the full HTML
Working Group, please add the TrackerRequest keyword to this bug, and suggest
title and text for the tracker issue; or you may create a tracker issue
yourself, if you are able to do so. For more details, see this document:
Change Description: No spec change.
Rationale: See comments 2 and 4.
after re-reading this bug I think it should be closed, with the current resolution accepted.
It was re-opened by the a11y taskforce, but I don't see anything specific to accessibility about it and the resolution seems reasonable.
This sounds like a new feature request and anybody interested in pursuing should follow up with implementers.