Closed Bug 165529 Opened 23 years ago Closed 23 years ago

Resetting a form does not reset hidden fields

Categories

(Core :: Layout: Form Controls, defect, P3)

x86
Linux
defect

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
to form controls
Assignee: alexsavulov → jkeiser
Status: UNCONFIRMED → NEW
Component: Form Submission → HTML Form Controls
Ever confirmed: true
QA Contact: vladimire → tpreston
Status: NEW → ASSIGNED
There are no defaultValue property on the hidden form element. (Also no form property)
When .defaultValue is fixed on input type=text, this will become possible. Setting dependent.
Depends on: 184732
Priority: -- → P3
Target Milestone: --- → mozilla1.4alpha
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?
That is this bug.
Er, wait, no it's not this bug. Hasty me. Best file another bug.
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 &nbsp;&nbsp; <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"> &nbsp;&nbsp; <input type="button" onClick="showData(document.testform)" value="Show Data"> &nbsp;&nbsp; <input type="button" onClick="document.testform.reset()" value="Reset Form"> </form>
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 &nbsp;&nbsp; <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"> &nbsp;&nbsp; <input type="button" onClick="showData(document.testform)" value="Show Data"> &nbsp;&nbsp; <input type="button" onClick="document.testform.reset()" value="Reset Form"> </form>
No longer depends on: 184732
Yep, dup. *** This bug has been marked as a duplicate of 158209 ***
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.