Closed Bug 745189 Opened 12 years ago Closed 10 years ago

Firefox requiring checking of all checkboxes when required attribute set

Categories

(Core :: DOM: HTML Parser, defect)

11 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: richard, Unassigned)

Details

Attachments

(1 file)

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
Closed: 10 years ago
Resolution: --- → INVALID
Component: Untriaged → HTML: Parser
Product: Firefox → Core
Attached file 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.

Attachment

General

Creator:
Created:
Updated:
Size: