...

View Full Version : action select not working



florida
12-01-2006, 08:06 PM
I am trying to get my action page to work where if
the user selects yes to Employee radio button then it goes to a certain page,
if not it goes to another page. It doesnt do anything on submit and when I do an alert on alert(document.myFrm.employee.action) for test only form submit it gives me Undefined message.

Please advise what I am doing wrong?


function mySelection()
{
if(document.myFrm.employee.value == "yes")
{
document.myFrm.employee.action='gotoEmployee.cfm';
}
else
{
document.myFrm.employee.action='secondPage.cfm';
}
}

...
<form name="myFrm" method="post" onSubmit="return mySelection();">
<input name="employee" type="radio" value="yes">
<input name="employee" type="radio" value="no">
...

nikkiH
12-01-2006, 08:18 PM
The form has an action, not the form element.

i.e.
document.myFrm.action='gotoEmployee.cfm';

Mr J
12-02-2006, 12:03 AM
Try it this way


function mySelection(){
if(document.myFrm.employee[0].checked){
document.myFrm.employee.action='gotoEmployee.cfm';
}
else{
document.myFrm.employee.action='secondPage.cfm';
}
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum