FF – required input validated no matter execution runs in handler
I have some background form submission implemented. Similar to
form.onsubmit = function XY(e) { e.prevenDefault(); … }
In form there is (similar) input
<input type="text" name="someName" required="required" class="toBeCleared"/>
Then there is (similar) JS.
if(e.currentTarget.elements["someName"].className === "toBeCleared") { e.currentTarget.elements["someName"].value = ''; }
Everything works as expected except that in FF after all work is done the field is marked with red color as not validated (since it is empty and required).
Return false, true from body of handler has no effect on this.
Alterado por cor-el em
Todas as respostas (2)
Maybe remove the required attribute or put some dummy content in it after you have confirmed that the data is valid?
Try to ask advice at the Stack Overflow forum site.
cor-el said
Maybe remove the required attribute or put …
I was just about to get info if it is known bug, feature or whatever else there can be known about it.
I can invent some workaround anyway.
Alterado por fire-in-the-mine-hole em