I have a e-commerce system I am trying to iron out. There is a typicle form that captures the shipping and billing information from the user. There is an option for copying billing info to shipping and I need to perform a check on the required fields for both billing and shipping (if they are not copying info from one to the other). I have two radio buttons on the form (see below) for selecting to copy or not. I am trying to do a conditional statement in javascript to see if the value of the radio button is 'yes' or 'no', then I know if I need to validate fields for shipping or not. Being new to javascript I am having a tough time with the syntax of determining the value of the radio button. The code for the radio buttons are below and what I have so far for the javascript.
Any suggestions?
Thanks
Ian
----Radio buttons -----
<input type="radio" name="BillAddShip" value=http://www.webdeveloper.com/forum/archive/index.php/"Yes" Checked>Yes<br>
<input type="radio" name="BillAddShip" value="No">No
------Javascript-----
if (document.form1.billaddship.value == "No"){
if(trim(document.form1.nameship.value)){
alert("Please input your Shipping Name!");
document.form1.nameship.focus();
return false;
}
}
Any suggestions?
Thanks
Ian
----Radio buttons -----
<input type="radio" name="BillAddShip" value=http://www.webdeveloper.com/forum/archive/index.php/"Yes" Checked>Yes<br>
<input type="radio" name="BillAddShip" value="No">No
------Javascript-----
if (document.form1.billaddship.value == "No"){
if(trim(document.form1.nameship.value)){
alert("Please input your Shipping Name!");
document.form1.nameship.focus();
return false;
}
}