Closed Bug 259486 Opened 20 years ago Closed 20 years ago

Setting checkbox.disabled to false when it already is false clears the value for the checkbox when reloading

Categories

(Core :: DOM: Core & HTML, defect, P2)

x86
All
defect

Tracking

()

RESOLVED FIXED
mozilla1.8alpha4

People

(Reporter: u80, Assigned: bzbarsky)

Details

Attachments

(2 files, 1 obsolete file)

User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7) Gecko/20040614 Firefox/0.9 Build Identifier: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7) Gecko/20040614 Firefox/0.9 We have a webpage with a input checkbox that is checked via HTML. In the onLoad-handler, we set checkbox.disabled to false even though it already is false. When the page is loaded the first time the checkbox appears checked, but if you reload the page, the checkbox is unchecked. This problem has been found in Firefox 0.9 on Windows NT, Mozilla 1.6, 1.7 and 1.8 Alpha as well as Mozilla 1.6 from Debian testing on Linux. Reproducible: Always Steps to Reproduce: 1. Load the attached testcase (coming up) 2. Verify that the checkbox is checked. 3. Press the reload button Actual Results: 4. The checkbox is no longer checked Expected Results: 4. The checkbox should still be checked. This bug has the potential to cause dataloss, since if you do submit without noticing that the checkbox has been unchecked, bad things can happen.
The original testcase is not valid HTML. This one is. There is no difference in behaviour from the original testcase.
Attachment #158955 - Attachment is obsolete: true
The problem here is that the checkbox doesn't set its "checked" state if state was restored. In this case state was restored because there was "disabled" state. But the checkbox doesn't save its checked state in the history if its checked value is the default. So we never end up setting it checked. Possible options here: 1) Save the checked value no matter what (undoing part of the fix for bug 62713) 2) Save the checked value if it's changed or if we're storing something else in the state. 3) Redefine the return value of RestoreState() to indicate something about whether "checked" was restored... #3 is probably the least intrusive and least memory-intensive, but will we ever care about getting other information out through that return value? jst? Thoughts?
Severity: normal → major
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch PatchSplinter Review
Comment on attachment 159447 [details] [diff] [review] Patch jst, would you take a look?
Attachment #159447 - Flags: superreview?(jst)
Attachment #159447 - Flags: review?(jst)
Comment on attachment 159447 [details] [diff] [review] Patch r+sr=jst
Attachment #159447 - Flags: superreview?(jst)
Attachment #159447 - Flags: superreview+
Attachment #159447 - Flags: review?(jst)
Attachment #159447 - Flags: review+
Assignee: general → bzbarsky
Priority: -- → P2
Target Milestone: --- → mozilla1.8alpha4
Fixed for 1.8a4.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: