Conditional submit
Hi everyone,
I have a form where I have 2 dropdown lists which have a Y or N value. I want to submit the form to some page if the value of list a is Y and to another page if the value of list b is Y. I have a validation function called in the onsubmit of the form tag.I have used document.form.submit in the javascript function where the return value is true. But this code is not working and since I am using the javascript function I am not putting the target page in the action text. I am writing my code below:
--------------------------------------------
if(document.form1.cbopaystatus.value=="N" && document.form1.cboshipmentstatus.value=="Y")
{
alert("Shipment status cannot be Shipped if payment status is Unpaid.");
document.form1.cbopaystatus.focus();
return false;
}
if(document.form1.cbopaystatus.value=="Y")
{
document.form1.submit="aaa.asp"
}
else if(document.form1.cboshipmentstatus.value=="Y")
{
document.form1.submit="bbb.asp"
}
return true;
}
Here cbopaystatus & cboshipmentstatus are the 2 dropdown fields which have Y & N as values.
Any help would be appreciated.
Thanks in advance!!
|