WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 35472
Radio buttons always be in valueMissing state if they are in a form element
https://bugs.webkit.org/show_bug.cgi?id=35472
Summary
Radio buttons always be in valueMissing state if they are in a form element
Brenton
Reported
2010-02-27 01:21:35 PST
What steps will reproduce the problem? 1. Create an input group of the type 'radio' with @required set. 2. Check one of the boxes. 3. Call widget.checkValidity() What is the expected result? If any box in the group is checked, the whole control is valid. widget.checkValidity() should return true. What happens instead? widget.checkValidity() always returns false if a radio group is required, and causes document.forms[0].checkValidity() to also return false. It does this even if a button is checked (which defies the spec), or if the button you call it against is checked (which defies logic). Please provide any additional information below. From the HTML5 spec: "Constraint validation: If the element is required and all of the input elements in the radio button group have a checkedness that is false, then the element is suffering from being missing." Although not technically a regression, this bug breaks existing sites. Any site that was using feature detection to call the HTML5 validity API no longer works. document.forms[0].checkValidity is not null, so the native API will be used; however, this bug makes any form with a required radio group fail the checkValidity test. This can prevent forms from being submitted. ImARegular.com has begun to receive reports that our surveys no longer work in Chrome. The workaround is to use the attached JavaScript code to detect is the HTML5 validity API is properly supported. It also functions as a test case. Chromium Bug:
http://code.google.com/p/chromium/issues/detail?id=36962
-------- Test case -------- var hasCheckValidity = document.forms[0].checkValidity; if (hasCheckValidity) { var testForm = document.createElement('form'); var testInput = []; var addTestWidget = function(i) { testInput[i] = document.createElement('input'); testInput[i].type = 'radio'; testInput[i].required = 'required'; testInput[i].name = 'radio_validity_test'; testInput[i].value = i; testForm.appendChild(testInput[i]); } addTestWidget(0); addTestWidget(1); testInput[0].checked = true; hasCheckValidity = testInput[1].checkValidity(); }
Attachments
Proposed patch
(8.91 KB, patch)
2010-02-27 07:00 PST
,
Kent Tamura
eric
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Kent Tamura
Comment 1
2010-02-27 06:27:59 PST
Ok, I confirmed. We have a test for radio buttons, but it covers only a case of no <form> element.
Kent Tamura
Comment 2
2010-02-27 07:00:43 PST
Created
attachment 49682
[details]
Proposed patch
Eric Seidel (no email)
Comment 3
2010-03-05 15:28:57 PST
Comment on
attachment 49682
[details]
Proposed patch The style bot failed to catch this spacing error: (yes, I realize you were just moving code) 166 static inline CheckedRadioButtons& checkedRadioButtons(const HTMLInputElement *element) otherwise looks good.
Kent Tamura
Comment 4
2010-03-07 17:42:18 PST
(In reply to
comment #3
)
> (From update of
attachment 49682
[details]
) > The style bot failed to catch this spacing error: (yes, I realize you were just > moving code) > 166 static inline CheckedRadioButtons& checkedRadioButtons(const > HTMLInputElement *element) > > otherwise looks good.
Ok, I'll fix it and land.
Kent Tamura
Comment 5
2010-03-07 17:54:45 PST
Landed as
r55640
<
http://trac.webkit.org/changeset/55640
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug