beautyfiend
07-07-2009, 05:05 PM
Hi,
This is doing my head in, I don't know what is wrong with my code but my radio button validation is not working.:(
I think maybe the 'card.length? I checked for errors on PSPad and nothing came up...
Any help greatly appreciated!
cardcheck= -1;
for (i=myform.card.length -1; i > -1; i-) {
if (myform.card[i].checked) {
cardcheck = i; i= -1;
}
}
if (cardcheck == -1 {
alert ("Must select Card Type");
return false;
}
And:
Visa<input type="radio" name="card" value="Visa">
<br /><br />
Amex <input type="radio" name="card" value="Amex">
<br /><br />
Mastercard <input type="radio" name="card" value="Mastercard">
<br /><br />
This is doing my head in, I don't know what is wrong with my code but my radio button validation is not working.:(
I think maybe the 'card.length? I checked for errors on PSPad and nothing came up...
Any help greatly appreciated!
cardcheck= -1;
for (i=myform.card.length -1; i > -1; i-) {
if (myform.card[i].checked) {
cardcheck = i; i= -1;
}
}
if (cardcheck == -1 {
alert ("Must select Card Type");
return false;
}
And:
Visa<input type="radio" name="card" value="Visa">
<br /><br />
Amex <input type="radio" name="card" value="Amex">
<br /><br />
Mastercard <input type="radio" name="card" value="Mastercard">
<br /><br />