...

View Full Version : Radio action buttons not responding



florida
07-06-2004, 07:23 PM
I am trying to get my radio buttons to have two choices where each one takes me to a different action page. It keeps giving me the error:

document.queryForm.myAction2 is null or not an object

Here is my attempt:


<SCRIPT language="JavaScript">



function do_submit()
{
if (document.queryform.myAction2[0].checked)
{
document.queryform.action = 'PageOne.cfm';
//document.queryform.submit(); it bombs with or without this line uncommented

}
else if (document.queryform.myAction2[1].checked)
{
document.queryform.action = 'PageTwo.cfm';
// document.queryform.submit(); it bombs with or without this line uncommented
}
}
</SCRIPT>



The calling area and radio buttons:


<FORM METHOD="post" NAME="queryForm" onsubmit="do_submit();">
....
<input type="radio" name="myAction2" checked> first action<br>
<input type="radio" name="myAction2"> second action


Please advise.

DooM_MonkeY
07-06-2004, 07:31 PM
Just go

<input type="radio" onfocus="window.location='theUrl.htm';"><br>
<input type="radio" onfocus="window.location='theUrl2.htm';">

florida
07-06-2004, 08:15 PM
That didnt work. Any other suggetions?

Willy Duitt
07-06-2004, 08:54 PM
Try using: document.forms['FormName'].setAttribute('action',radioButtonValue)

JohnKrutsch
07-07-2004, 07:12 AM
You had it right the first time except you were not case sensitive. Your form is named queryForm with a capital F yet you are referencing it as queryform. Case counts in JavaScript.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum