This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17827 - Required edit should be applicable to fieldset
Summary: Required edit should be applicable to fieldset
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-18 06:56 UTC by contributor
Modified: 2012-09-21 06:17 UTC (History)
6 users (show)

See Also:


Attachments

Description contributor 2012-07-18 06:56:10 UTC
This was was cloned from bug 16061 as part of operation convergence.
Originally filed: 2012-02-21 16:36:00 +0000
Original reporter: Léonie Watson <tink@tink.co.uk>

================================================================================
 #0   Léonie Watson                                   2012-02-21 16:36:58 +0000 
--------------------------------------------------------------------------------
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.
================================================================================
 #1   Michael Cooper                                  2012-02-21 16:41:26 +0000 
--------------------------------------------------------------------------------
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.
================================================================================
 #2   Boris Zbarsky                                   2012-02-22 14:48:35 +0000 
--------------------------------------------------------------------------------
> 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.
================================================================================
 #3   Evert                                           2012-02-23 16:27:37 +0000 
--------------------------------------------------------------------------------
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).
================================================================================
 #4   Boris Zbarsky                                   2012-02-23 16:55:35 +0000 
--------------------------------------------------------------------------------
> Would the way radiobuttons work with the required attribute also work with
> checkboxes?

No.

> 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....
================================================================================
 #5   Evert                                           2012-02-23 17:12:38 +0000 
--------------------------------------------------------------------------------
> 
> 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.
================================================================================