Click to See Complete Forum and Search --> : Re-validating a form after failed submit?


arothman
07-10-2003, 12:38 PM
I am working on a form (look at it online here (http://www.collaborativefamilylaw-mo.com/contact.html)) and am having an issue with the validation.

Here's the problem:

The idea is that if both checkboxes at the top are unchecked, the form cannot be submitted. Now, if the user unchecks both boxes and then hits submit, they get the error telling them to check one, which is correct. However, if they go back up and check a box without reloading the page, the script still tells you to check a box when you hit submit.

Is there a way to 're-validate' the form without reloading the page and clearing all of the entered information?

Thanks!
Drew

Jona
07-10-2003, 12:47 PM
if (!((form.brochure.checked) && (form.attorneycall.checked))) {
alert( "At least one of the checkboxes must be marked before your message can be sent." );
form.brochure.focus();
return false ;
}


Are you sure the above wasn't meant to be this?


if (!(form.brochure.checked) || !(form.attorneycall.checked)) {
alert("At least one of the checkboxes must be marked before your message can be sent.");
form.brochure.focus();
return false;
}


[J]ona

arothman
07-10-2003, 01:49 PM
Well no, I do want an && and not an ||, but you did find my problem for me! What I really needed was if ((!form.brochure.checked) && (!form.attorneycall.checked)). It works great now!

Thanks,
Drew