Closed Bug 942321 Opened 6 years ago Closed 6 years ago
If you have a form with a required <select> element with a single <option> item without a value, and then change the value to something valid, the form still returns invalid. See this jsfiddle: http://jsfiddle.net/DxWUs/ It works in chromium, but not firefox. I'm using 23.0a1 (2013-05-09), but it was also reported on FireFox 25.0.1
What's the result in Chomium? With FF25 on Win 7, I have false/false/true.
Component: General → DOM: Core & HTML
Product: Firefox → Core
In Chromium it's false/true/true. Jonas, who's doing forms stuff now, again?
Flags: needinfo?(psychicsurgeon) → needinfo?(jonas)
I hear it's jwatt? ;)
Flags: needinfo?(jonas) → needinfo?(jwatt)
I've been doing some forms work, but not touched <select>. I can have a look but I can't see me getting to that before January.
(In reply to Loic from comment #1) > What's the result in Chomium? > > With FF25 on Win 7, I have false/false/true. Chromium returns false/true/true, which is what I would think would be "correct".
I think I know where the problem is, I'll post a patch by next week.
Assignee: nobody → agi.novanta
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Version: 23 Branch → Trunk
So here the problem is what one would expect, namely that when Option's @value changes the Select element is not notified and consequently the validity state not updated. What I'm doing here is adding a new function to the Select element, OptionValueChanged. This function is called in Option's AfterSetAttr. I'm not very sure of adding this function, but I haven't find a better way of notifying the Select element. Johnny what do you think? Ah, I also added a mochitest, but if you feel is not necessary I don't mind removing it. Thanks!
Attachment #8416288 - Flags: feedback?(bzbarsky) → feedback+
I thought that exposing the "UpdateValidityState" was bad because from the perspective of a user of HTMLSelectElement the validity should always be current (does that make sense?). But now I'm seeing that, e.g. HTMLInputElement exposes the same member function, so it's probably pointless to hide this bit of the implementation. Thank you both!
Attachment #8416956 - Flags: review?(bzbarsky) → review+
Oh, I missed Selected()! No, probably it's not the same thing. Thanks Boris! Not asking to review again since it's just a name change. Already pushed to Try here: https://tbpl.mozilla.org/?tree=Try&rev=7e7b0bfad8dc Good to go! Thank you.
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.