Valid e mail address on forms

adalt's picture

They have: 72 posts

Joined: Dec 2000

What do I need to add to a form to make sure that the person filling it out entered a valid e mail address ??

Thanks

Tony

Justin S's picture

They have: 2,076 posts

Joined: Jun 1999

Moving to the HTML & JavaScript Help Forum...

They have: 135 posts

Joined: Apr 2000

Here's the Javascript I use, picked up from somewhere on the web Smiling

var re = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;

if (re.test(EmailAddr) == false) {
   alert("Not a valid e-mail address");
   return false;
} else {
   return true;
}
'

Basically it compares the given email address to a "regular expression" which requires something with letters and/or digits followed by a @ and something else with letters and/or digits which contains at least one period.

Of course, this only tests the format, and someone could still enter a non-existent address...

They have: 81 posts

Joined: Feb 2000

For a low tech approach- if you have autoresponder capability for your site you can have your form send an autoresponse to the email addy provided.

If it bounces, it wasn't a good one.

My forms pages explain that if they want a response from me they have to provide a valid email addy. My forms forward my visitors to a "Thank You" page that informs them that they should get the autoresponder message, and what the probable reason for not getting one is.

I figure if they aren't serious enough to provide a valid email addy, I don't need to worry about them not hearing from me.

Bimjo
Just my opinion, worth $0.00001 anywhere on earth.
======================
Bimjo's Corner

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.