Closed Bug 62846 Opened 24 years ago Closed 24 years ago

Checking if form radio button is selected (via javascript) returns false info

Categories

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

x86
Windows 2000
defect

Tracking

()

VERIFIED DUPLICATE of bug 57239

People

(Reporter: trhaverstock, Assigned: rods)

References

()

Details

From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
BuildID:    20001205

If you check to see if a radio button is selected, the wrong boolean value is 
returned as illustrated in the URL listed in this bug ticket.  This is a toned-
down code snippet from an app I use to conditionally disable form fields.  The 
net-net is that if I pop an alert to display what it thinks is selected, it 
often lists 2 of the three radio buttons as being true (checked).

Reproducible: Always
Steps to Reproduce:
1. Goto the URL listed.
2. Loop through the three radio buttons forwards in order, then backwards.

Actual Results:  The wrong text fields are disabled because the JS code is not 
correct in reporting what radio buttons are selected.

Expected Results:  The 1st text should be input enabled when radio button #1 is 
selected, #2 -> #2, etc.

This code snippet works fine in NS4.X, IE4, IE5.0 5.5 but not in Mozilla .6 
milestone (or NS6).
I think this now works with a current build. Did you test this with the current 
release of 6.0? If so, I have fixed this since then.
I tested with NS6.0, M18, and M0.6.  It is a bug in all three.  I just 
downloaded the current build (2000121404) and it -IS- fixed in that build.  Do 
you know if there is a good workaround for this since it's in NS6?  My end 
users could potentially be using the 6.0 revv.  I think what was happening is 
that it was returning True for the new and the last previous radio button 
selected instead of true only the newly selected radio button.
Looks like my attempt to add comments got eaten by insufficient permission. 
Sorry for the noise.

This is a duplicate of bug 57239. It was recently fixed. And there was much 
rejoicing. Yay!

The only work around that I can think of is to explicitly pass the information 
from the onclick event. For example, in your sample code at the URL, you could 
pass ManageForm(1) in the onclick event for option1. You'd then need to modify 
the ManageForm function to use the parameter instead of relying on the radio 
selection to be correct.

Believe me, I feel your pain. I've had to make similar changes to my code. In a 
case with just two radio buttons, it seems that NS6 users can click the radio 
button twice (not that they'd think to do that).
Marking duplicate, let's thank Rod fox fixing this hellova bug! ;)

*** This bug has been marked as a duplicate of 57239 ***
Status: UNCONFIRMED → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
vrfy dup
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.