Closed
Bug 165529
Opened 22 years ago
Closed 22 years ago
Resetting a form does not reset hidden fields
Categories
(Core :: Layout: Form Controls, defect, P3)
Tracking
()
RESOLVED
DUPLICATE
of bug 158209
mozilla1.4alpha
People
(Reporter: duke, Assigned: john)
References
()
Details
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1b) Gecko/20020829 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1b) Gecko/20020829 After altering the value of a hidden form field with Javascript and clicking the Reset button the value of hidden fields is not reset. Reproducible: Always Steps to Reproduce: 1.Load the URL 2.Click 'Show value' - An alert box should pop up with number 33 in it (that's the default value of a hidden form field). 3.Click 'Set value ...' 4.Click 'Show value' again - the alert box should now show '66' 5.Click 'Reset' 6.Click 'Show value' Actual Results: Alert box displays number 66 Expected Results: Alert box should display number 33 Tested on Linux, Mozilla 2002082904. Also tested with NS4.78 (Linux) and Opera 6.0 (Linux). Both display '66' after step #6 Konqueror 3.0+ and IE5.5+ display '33' - which I believe is correct.
Confirmed Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826
Comment 2•22 years ago
|
||
to form controls
Assignee: alexsavulov → jkeiser
Status: UNCONFIRMED → NEW
Component: Form Submission → HTML Form Controls
Ever confirmed: true
QA Contact: vladimire → tpreston
Assignee | ||
Updated•22 years ago
|
Status: NEW → ASSIGNED
Comment 3•22 years ago
|
||
There are no defaultValue property on the hidden form element. (Also no form property)
Assignee | ||
Comment 4•22 years ago
|
||
When .defaultValue is fixed on input type=text, this will become possible. Setting dependent.
Comment 5•22 years ago
|
||
I don't sure if this is a dup: When I press F5 or Ctrl-F5 to reload the page, hidden fields are NOT resetted. Shouldn't they reparsed from the orginal HTML file? This annoy me very much and inconsistence with IE.. Will this fix in this bug or should I file another bug report?
Assignee | ||
Comment 6•22 years ago
|
||
That is this bug.
Assignee | ||
Comment 7•22 years ago
|
||
Er, wait, no it's not this bug. Hasty me. Best file another bug.
Comment 8•22 years ago
|
||
Dup of bug 158209? Calling the reset() function does not reset hidden fields. Can test with code below: <html> <head> <script language="JavaScript"> <!-- function showData(form) { var msg = "Form Data"; msg += "\r\n\r\nHidden: " + form.hiddenval.value; msg += "\r\nText: " + form.textval.value; msg += "\r\nRadio: " + getRadioValue(form.radioval); msg += "\r\nCheckbox: " + form.checkboxval.checked; msg += "\r\nSelect: " + form.selectval[form.selectval.selectedIndex].value;; alert(msg); } function setHidden() { document.testform.hiddenval.value = "HiddenVal"; alert("Hidden value now set to 'HiddenVal'"); } function getRadioValue (radioButtonOrGroup) { var value = null; if (radioButtonOrGroup.length) { // group for (var b = 0; b < radioButtonOrGroup.length; b++) if (radioButtonOrGroup[b].checked) value = radioButtonOrGroup[b].value; } else if (radioButtonOrGroup.checked) value = radioButtonOrGroup.value; return value; } // --> </script> </head> <body> <form name="testform"> <input type="hidden" name="hiddenval"> Text: <input type="text" name="textval"><br> Radio: <input type="radio" name="radioval" value="radiodata1"> 1 <input type="radio" name="radioval" value="radiodata2"> 2<br> Checkbox: <input type="checkbox" name="checkboxval" value="checkboxdata"><br> Select: <select name="selectval"><option value=""></option><option value="selectdata1">1</option><option value="selectdata2">2</option></select> <br> <input type="button" onClick="setHidden()" value="Set Hidden Value"> <input type="button" onClick="showData(document.testform)" value="Show Data"> <input type="button" onClick="document.testform.reset()" value="Reset Form"> </form>
Comment 9•22 years ago
|
||
Dup of bug 158209? Calling the reset() function does not reset hidden fields. Can test with code below: <html> <head> <script language="JavaScript"> <!-- function showData(form) { var msg = "Form Data"; msg += "\r\n\r\nHidden: " + form.hiddenval.value; msg += "\r\nText: " + form.textval.value; msg += "\r\nRadio: " + getRadioValue(form.radioval); msg += "\r\nCheckbox: " + form.checkboxval.checked; msg += "\r\nSelect: " + form.selectval[form.selectval.selectedIndex].value;; alert(msg); } function setHidden() { document.testform.hiddenval.value = "HiddenVal"; alert("Hidden value now set to 'HiddenVal'"); } function getRadioValue (radioButtonOrGroup) { var value = null; if (radioButtonOrGroup.length) { // group for (var b = 0; b < radioButtonOrGroup.length; b++) if (radioButtonOrGroup[b].checked) value = radioButtonOrGroup[b].value; } else if (radioButtonOrGroup.checked) value = radioButtonOrGroup.value; return value; } // --> </script> </head> <body> <form name="testform"> <input type="hidden" name="hiddenval"> Text: <input type="text" name="textval"><br> Radio: <input type="radio" name="radioval" value="radiodata1"> 1 <input type="radio" name="radioval" value="radiodata2"> 2<br> Checkbox: <input type="checkbox" name="checkboxval" value="checkboxdata"><br> Select: <select name="selectval"><option value=""></option><option value="selectdata1">1</option><option value="selectdata2">2</option></select> <br> <input type="button" onClick="setHidden()" value="Set Hidden Value"> <input type="button" onClick="showData(document.testform)" value="Show Data"> <input type="button" onClick="document.testform.reset()" value="Reset Form"> </form>
Assignee | ||
Comment 10•22 years ago
|
||
Yep, dup. *** This bug has been marked as a duplicate of 158209 ***
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•