Closed
Bug 57239
Opened 24 years ago
Closed 24 years ago
[FIX][RBTN]Radio button onclick fires before clearing previous checked value
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
RESOLVED
FIXED
People
(Reporter: tpowellmoz, Assigned: rods)
References
Details
(Whiteboard: Fix in hand)
Attachments
(1 file)
1.15 KB,
text/html
|
Details |
User-agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; m18) Gecko/20001010 BuildID: 2000101014 The onclick event handler for the radio button is called before the previous value of the radio button is cleared. This is different than with Netscape 4.x and IE. In these other browsers the current Radio array element is marked checked, the old element is cleared, and then the onclick event fires. The following code demonstrates having two radio buttons marked checked at the same time: <html> <head> <title>Radiobutton onClick and checked attribute test</title> <script type="text/javascript"> function clickRadio() { var t = document.forms[0].cb; //or document.getElementsByName("cb"); var str = ""; for (var i=0; i<t.length; i++) str += t[i].value + ":" + t[i].checked + " "; alert(str); } </script> </head> <body> <form> <input name=cb id=cb0 type=radio value="0" onclick="clickRadio()" checked><label for="cb0">Zero</label><br> <input name=cb id=cb1 type=radio value="1" onclick="clickRadio()"><label for="cb1">One</label><br> <input name=cb id=cb2 type=radio value="2" onclick="clickRadio()"><label for="cb2">Two</label> </form> </body> </html> Click on item One and the alert shows "0:true 1:true 2:false". Having two elements marked checked makes it hard to tell which is the current item in the radio set. Expected Result is for the alert to show "0:false 1:true 2:false". I'd expect this breaks a lot of existing pages. This may be a problem with the previous fix in bug 42972. It also appears that the radio buttons are acting like checkboxes. You can click on a radio button that is set and it will clear itself, the alert will show "0:false 1:false 2:false" and then it will reset to be marked.
Assignee | ||
Comment 2•24 years ago
|
||
Yes, it is wrong and I now what needs to be donw. This will have to be fixed in the next release.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Target Milestone: --- → Future
Assignee | ||
Updated•24 years ago
|
Summary: Radio button onclick fires before clearing previous checked value → [RBTN]Radio button onclick fires before clearing previous checked value
Reporter | ||
Comment 3•24 years ago
|
||
Assignee | ||
Updated•24 years ago
|
Summary: [RBTN]Radio button onclick fires before clearing previous checked value → [FIX][RBTN]Radio button onclick fires before clearing previous checked value
Whiteboard: Fix in hand
Assignee | ||
Updated•24 years ago
|
Target Milestone: Future → ---
Assignee | ||
Comment 4•24 years ago
|
||
fixed
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Updated•24 years ago
|
Component: DOM Level 2 → DOM HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•