Closed
Bug 275473
Opened 20 years ago
Closed 20 years ago
Reloading a page - checkboxes change state
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: leighprotect-bugzilla, Assigned: bugzilla)
Details
Using the following code: - Load the page and both checkboxes should be checked - Hit the reload button and the second checkbox will now be unchecked - Also occurs if you go back to the page after submitting the form This is a simplified version of a page I'm writing, the main problem for me is that if a user goes back to the page, their previous selections are lost. --------------------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Checkbox/Javascript Bug Page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="javascript1.2" type="text/javascript"> <!-- function disableBox() { var theForm = document.getElementById("test_form"); theForm.elements["cb_B"].disabled = !theForm.elements["cb_A"].checked; if (theForm.elements["cb_B"].disabled) theForm.elements["cb_B"].checked = false; } --> </script> </head> <body onload="disableBox()"> <form id="test_form" method="post" action="http://www.mozilla.org/products/firefox/"> <table> <tr> <th>Option A</th> <td><input type="checkbox" name="cb_A" value="a" checked onclick="disableBox()" /></td> </tr> <tr> <th>Option B (depends on option A)</th> <td><input type="checkbox" name="cb_B" value="b" checked onclick="disableBox()" /></td> </tr> <tr> <td colspan="2"> <button type="submit">Continue</button> </td> </tr> </table> </form> </body> </html>
| Reporter | ||
Comment 1•20 years ago
|
||
Note - this works under ie. The code within the if statement is never reached on a page reload to set cb_B unchecked (using an alert statement to debug). Also, if the line: theForm.elements["cb_B"].disabled = !theForm.elements["cb_A"].checked; is removed, the problem doesn't occur, but the page doesn't function either! :) Interestingly, the removed line doesn't do anything to set the checked attribute of cb_B.
Comment 2•20 years ago
|
||
I see what you mean in Firefox 1.0, but in either a nightly trunk build of Firefox or Moz 1.8a6, it works just like it should, so it's already fixed, somewhere after the stable-but-stale branch of the backend code for 1.0. Next release should do the right thing, even though that's not much comfort now.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•