marynorn
04-16-2008, 10:56 AM
I have a checkbox on my registration form for people to tick that they've read the terms and conditions. If they don't check it they get an error message, and if they do check it the forms submits.
If I use the following code:
function checkForm(form)
{
if(!form.tandc.checked) {
alert("Please confirm that you have read the Terms & Conditions");
}
return false;
}
I get the popup, but the once the box is checked the form won't submit. If I take out the 'return false' the page submits as soon as you hit the OK button on the popup.
I suspect I have to put in an else conditional, but I haven't the faintest idea what it should be. Javascript is really not my thing.
And while I'm here... I need to add another bit to that checkform so the password field matches the confirm password field. I'm lost on this one. I have a snippet of code, but it's obviously missing something:
if(form.passwod.value != "" && form.password.value == form.pwdcheck.value) {
alert("Your password does not match the confirmation password")
}
If I use the following code:
function checkForm(form)
{
if(!form.tandc.checked) {
alert("Please confirm that you have read the Terms & Conditions");
}
return false;
}
I get the popup, but the once the box is checked the form won't submit. If I take out the 'return false' the page submits as soon as you hit the OK button on the popup.
I suspect I have to put in an else conditional, but I haven't the faintest idea what it should be. Javascript is really not my thing.
And while I'm here... I need to add another bit to that checkform so the password field matches the confirm password field. I'm lost on this one. I have a snippet of code, but it's obviously missing something:
if(form.passwod.value != "" && form.password.value == form.pwdcheck.value) {
alert("Your password does not match the confirmation password")
}