Closed
Bug 982039
Opened 11 years ago
Closed 10 years ago
Radio input required not working when element disabled by js
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla33
People
(Reporter: markus.doits, Assigned: smaug)
Details
Attachments
(2 files)
4.12 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
3.93 KB,
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:28.0) Gecko/20100101 Firefox/28.0 (Beta/Release)
Build ID: 20140306171728
Steps to reproduce:
When a required radio input disabled by js after the page loaded, the required check is not working and submitting the form even nothing is checked.
See http://jsfiddle.net/3Xa4g/13/ - simply click on submit and the form is submitted even the radio input is not checked.
Actual results:
The form is submitted even no radio input is checked.
Expected results:
The form should be marked as invalid and not submitted until a radio button is checked.
Comment 1•11 years ago
|
||
Confirmed on Firefox 28 and on Nightly as well.
Works as I'd expect it to in Chrome, but not in Safari.
I'm not sure if this is an issue for HTML Form submission, or something else.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•11 years ago
|
Component: Untriaged → HTML: Form Submission
Product: Firefox → Core
Comment 2•11 years ago
|
||
This is a bit exciting.
HTMLInputElement::UpdateValueMissingValidityStateForRadio has this bit:
valueMissing = IsMutable() && required && !selected;
Of course in this case, IsMutable() is false. And then it does:
container->SetValueMissingState(name, valueMissing);
What we should probably do instead is just treat disabled+required radios as not required in HTMLFormElement::RadioRequiredChanged, invoke that when @disabled changes, and then drop the IsMutable() bits in UpdateValueMissingValidityStateForRadio, since those will no longer be necessary. Olli, would that make sense?
Flags: needinfo?(bugs)
Assignee | ||
Comment 3•10 years ago
|
||
Or this way.
https://tbpl.mozilla.org/?tree=Try&rev=5860a4db4c24
Comment 4•10 years ago
|
||
Comment on attachment 8453361 [details] [diff] [review]
patch
Hmm. I _think_ this works...
Attachment #8453361 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 5•10 years ago
|
||
Bah, ###!!! ASSERTION: mRequiredRadioCount about to wrap below 0!: 'radioGroup->mRequiredRadioCount != 0'
Assignee | ||
Comment 6•10 years ago
|
||
Oh, wait, that is an existing bug.
Assignee | ||
Comment 7•10 years ago
|
||
That is explained in https://bugzilla.mozilla.org/show_bug.cgi?id=940203#c102
Assignee | ||
Comment 8•10 years ago
|
||
Assignee | ||
Comment 9•10 years ago
|
||
Comment 10•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Updated•6 years ago
|
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•