Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FrontPage Help, e-mail verify on form.

Status
Not open for further replies.

teltech81

Vendor
Apr 11, 2001
3
0
0
US
On my form I want the user to verify e-mail address. If they don't type them the same I want an error message to alert them. Is it possible?
 
teltech81,

This is a script that I use. You will have to customise it to your own circumstances. What this scipt does is:

verifies that the first email address is a valid email address
verifies that the second email address is a valid email address
verifies that the two addresses are the same

Just set up your form to call this function on Submit.


<script>
var re = new RegExp(&quot;^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$&quot;);
var alpha = new RegExp(&quot;[a-zA-Z]&quot;);var digit = new RegExp(&quot;[0-9]&quot;);var truecount=0;
function valid(){
truecount=0;
mail1=document.RequestLogin.pwemail1.value;if(!re.test(mail1)){alert(&quot;You must enter a valid email address in the 'Email Address' field&quot;);truecount=0;return false;} else {truecount++;}
mail2=document.RequestLogin.pwemail2.value;if(!re.test(mail2)){alert(&quot;You must enter a valid email address in the 'Retype Email Address' field.&quot;);truecount=0;return false;} else {truecount++;}
if(mail1 != mail2){alert(&quot;Your email addresses do not match. Please retype.&quot;);truecount=0;return false;} else {truecount++;}
if(truecount==3){return true;} else { truecount=0; } }
</script> Mise Le Meas,

Mighty :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top