Hi there
Im new to the forum and wondering if someone could point me in the right directtion.
I have a html web form and Im trying to use JavaScript to validate the form before submitting.
Here’s my code so far:
function validate_form ( )
{
if (document.frm_contact_us.txtname.value == “”)
{
alert(“Please fill in the ‘Your Name’ box.”);
document.frm_contact_us.txtname.focus()
return false;
}
return true;
}
The problem is that even though javascript bring up an Alert box to notify that the txtname field is blank, the Form still get submitted – and I cant figure out why.
Any Pointers with would be greatly appreciated.
Thanks, James