Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

charl

macrumors newbie
Original poster
Sep 22, 2009
2
0
Hi, many visitors type their email address wrong. How can I make sure this does not happen?
 

notjustjay

macrumors 603
Sep 19, 2003
6,056
167
Canada, eh?
Hi, many visitors type their email address wrong. How can I make sure this does not happen?

There are a bunch of different ways, both on the client (browser) side and the server side.

On the client side, you can embed a Javascript that runs when the user clicks the form submit button. If the email address isn't valid, it could prevent the form from being submitted, pop up a dialog box and ask the user to re-enter a proper one. You can't rely on this alone, because some users don't browse with Javascript turned on.

On the server side, the script processing the submitted form data can also check for invalid data, and if it's not good, then re-display the form, usually with a little message saying "please enter a valid email address".

There's probably a ton of other ways, but these are two easy ones. You can Google for "form validation" or "email address validation" for lots of good tips and sample code.
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,852
9
USA
Are you wanting to validate the format of the email address, or the existence of the email address entered?
 

charl

macrumors newbie
Original poster
Sep 22, 2009
2
0
Are you wanting to validate the format of the email address, or the existence of the email address entered?

I wanted to validate the format, because some users write stupid things there. Unfortunatelly I discoverd that my hosting does not allow PHP. (maybe because is so cheap :D ) . I googled a little and now I am using http://www.123contactform.com. It's remotely hosted and I can add a field validation rule for my email address field.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.