Firefox requiring checking of all checkboxes when required attribute set

RESOLVED INVALID

Status

()

RESOLVED INVALID
7 years ago
4 years ago

People

(Reporter: richard, Unassigned)

Tracking

11 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20100101 Firefox/11.0
Build ID: 20120312181643

Steps to reproduce:

Tried to set up a group of checkboxes with the required attribute. Clicking one or more checkboxes required. Sample code:

<form>
    <input type="checkbox" name="group1" id="check1" value="Red" required />
    <label for="check1">Red</label>
    <input type="checkbox" name="group1" id="check2" value="Orange" required />
    <label for="check2">Orange</label>
    <input type="checkbox" name="group1" id="check3" value="Green" required />
    <label for="check3">Green</label>
    <button type="submit">Submit</button>
</form>


Actual results:

Firefox requires ALL checkboxes be checked.


Expected results:

If all boxes have the same name, only one should be required.
This is invalid per 

* https://www.w3.org/Bugs/Public/show_bug.cgi?id=9160
* http://www.w3.org/html/wg/tracker/issues/111?changelog

checkbox and required don't work together well. To approximate the behavior you want you will need to use JavaScript. JQuery provides a way to get something close, http://stackoverflow.com/questions/6218494/using-the-html5-required-attribute-for-a-group-of-checkboxes
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → INVALID
Component: Untriaged → HTML: Parser
Product: Firefox → Core

Comment 2

4 years ago
Created attachment 8477787 [details]
Non-JQuery example

Takes advantage of fieldset and javascript .indeterminate
You need to log in before you can comment on or make changes to this bug.