[thelist] NN Form validation

Turley, Jay jayt at Meridinet.com
Tue Apr 4 13:10:40 2000


try the onSubmit() event handler:

<form action="" method="" onSubmit="return isValidData()">

then in your script:

<script>
function isValidData()
{
  if (document.formname.formelement1.value == "")
  {
    alert("You did not enter a value for 1!");
    return false;
  }

  if (document.formname.formelement2.value == "")
  {
    alert("You did not enter a value for 2!");
    return false;
  }

  return true;
}
</script>

-Jay Turley


> -----Original Message-----
> From: Ron White [mailto:rwhite@edverify.com]
> Sent: Tuesday, April 04, 2000 10:48 AM
> To: Evolt
> Subject: [thelist] NN Form validation
> 
> 
> What's the best way to validate a form before it's sent 
> that's cross-browser
> compatible? We were using an onClick function, which works in 
>