Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Radio button references?
Message
General information
Forum:
Internet
Category:
Javascript
Miscellaneous
Thread ID:
00239243
Message ID:
00239371
Views:
11
>(see Hugo, you spole to soon :) )
>
>I'm playing with HTML forms where the controls (or fields as FP98 calls them) get validated by my JavaScript functions. Once I kick out an alert message, I want to set focus to a vertain control. I can do it just fine with everything but Radio buttons, why? I know all the radio buttons in a group have the same name, but surely I could atleast set focus to the first one?
>
>for example this works:
>
>function RoxValid1(theForm)
>if (theForm.OtherForum!="ON")
>{	
>	alert("How about clicking the Other Check Box first?");
>	theForm.OtherForum.focus()
>	return (false);
>}
>return (true);
>
>
>but this doesn't work:
>
>function RoxValid2(theForm)
>if (theForm.FavoritePart!="Other")
>{	
>	alert("How about clicking the Other Radio Button first?");
>	theForm.FavoritePart.focus()
>	return (false);
>}
>return (true);
>
>and I've tried theForm.FavoritePart.click() too. Both ways throws a error telling me that theForm.FavoritePart object doesnt support this property or method. Is there anyway around this with radio buttons?
>
>(Dear John Harvey... it only took a few weeks, but yes I'm writing java script & have officially crossed over to the darkside! < duck > =D) )

Try this:

theForm.FavoritePart[whichone].checked=true
theForm.FavoritePart[whichone].focus()

Didn't try it, but it should (read "should") work.

Hugo
"My get up and go must've got up and went"
-Steve Tyler, Aerosmith
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform