Try This in the header...
<script language="JavaScript">
<!--
          function checkData (){
           if (document.forms[0].fromemail.value.length ==0){
          alert("Please enter valid email addresses.")
          return false}
         if (document.forms[0].fromemail.value.length >0){
          i=document.forms[0].fromemail.value.indexOf("@")
          j=document.forms[0].fromemail.value.indexOf(".",i)
          k=document.forms[0].fromemail.value.indexOf(",")
          kk=document.forms[0].fromemail.value.indexOf(" ")
          jj=document.forms[0].fromemail.value.lastIndexOf(".")+1
          len=document.forms[0].fromemail.value.length

         if ((i>0) && (j>(1+1)) && (k==-1) && (kk==-1) &&
         (len-jj >=2) && (len-jj<=3)) {
            }
          else {
            alert("Please enter valid email addresses.\n" +
            document.forms[0].fromemail.value + " is invalid.")
            return false}}
}
//-->
</script>

put this in the body....

<FORM METHOD="POST" ACTION="counseloremail.taf?function=mail" 
onSubmit="return checkData()">


>Anyone have a snippet to validate email address when it is entered in a form
>make sure it is valid format.
>
>
>--
>Dan Stein
>Digital Software Solutions
>799 Evergreen Circle
>Telford PA 18969
>Land: 215-799-0192
>Mobile: 610-256-2843
>FMP, WiTango, EDI,SQL 2000
>[EMAIL PROTECTED]
>www.dss-db.com
>
>
>________________________________________________________________________
>TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
>                 with unsubscribe witango-talk in the message body


-- 
________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Reply via email to