Closed
Bug 253226
Opened 20 years ago
Closed 13 years ago
Form reset() function does not always work
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: bamm, Unassigned)
References
Details
The form reset() function does not always work as expected. The following simple code illustrates this. <form> <input type="hidden" name="name" value="bamm"> <input type="submit"> </form> <script> var q = document.forms[0]; document.write(q.name.value + '<br>'); q.name.value = 'bamm2'; document.write(q.name.value + '<br>'); q.reset(); document.write(q.name.value + '<br>'); </script> The output of this code in Mozilla and Firefox is as follows: bamm bamm2 bamm2 The output of the same code in Konqueror is bamm bamm2 bamm The output of the same code in Internet Explorer is bamm bamm2 bamm I haven't checked it in Safari, but I would expect it to be the same as in Konqueror. Since Konq, Internet Explorer and Safari are default browsers in their respective platforms, most webmasters probably code according to expected results in these browsers, which is different from Mozilla. I also believe the results in Konq and IE are correct because the reset() function should restore all values to whatever they were when the page was first loaded.
![]() |
||
Comment 1•20 years ago
|
||
Not a JS engine issue. I believe changing "value" before the user has changed it will also change the defaultValue in Mozilla, for compat with IE... There are bugs with lengthy discussions of the bizarre relationship between .value and the value attribute in IE, which I recommend reading.
Assignee: general → general
Component: JavaScript Engine → DOM
QA Contact: pschwartau → ian
Whiteboard: DUPEME
Reporter | ||
Comment 2•20 years ago
|
||
Boris, please show me where I can read about this? Is there a standard for this? Is Konqueror and IE wrong? If Moz's action is standard then the standard just doesn't make sense to me.
Comment 3•20 years ago
|
||
This seems like a valid bug to me. We shouldn't be doing any stupid things with value changing the "value" attribute and thus the defaultValue DOM attribute.
Updated•15 years ago
|
Assignee: general → nobody
QA Contact: ian → general
Comment 5•13 years ago
|
||
input type=hidden is in the 'default' state, and the spec states: | The value IDL attribute allows scripts to manipulate the value | of an input element. The attribute is in one of the following | modes, which define its behavior: | ... | default | On getting, if the element has a value attribute, it must | return that attribute's value; otherwise, it must return | the empty string. On setting, it must set the element's | value attribute to the new value. <http://www.whatwg.org/html/#dom-input-value>.
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite?
Resolution: --- → INVALID
Comment 6•12 years ago
|
||
Ah, yeah, my bad.
Comment 7•12 years ago
|
||
(Though looking at the dates, I guess it's likely the spec changed in the meantime!)
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•