Another way is to put a
Return false
everytime the conditions are not met like...
Code:
function validate_form ( )
{
valid = true;
if ( enquire.txtname.value == "" )
{
alert ( "Please fill in the ' Name' box." );
valid = false;}
return false
}
And put this attribute in your form tags
Code:
onSubmit="return validate_form();"
I prefer doing it that way because then the javascript exits immediately a condition is not met and doesn't have to go through the whole code every time.