Verify Emails Before Sending Opt-In Form to Your Autoresponder

How often prospects submit your form without filling the fields Or enter abracadabra instead of their email address?… You autoresponder certainly rejects this form, but the prospect will see an error message.
Why confuse them when you can prompt to enter a real email before submitting the opt-in form. It’s possible with a simple javascript code.


Suppose you have an opt-in form like below:

<form method="post"
  action="http://yourdomain/autoresponder">
Name: <input name="name">
Email: <input name="email">
<input type="submit">
</form>

You can add onSubmit code into the <form>-tag to verify the name and email with the javascript below:

<script type="text/javascript">
<!--//
function verifyForm(theForm) {
  var nameRE = new RegExp(
    "^\\s*[\\w]+(\\s+[\\w]+)*\\s*$",
    "i");
  var emailRE = new RegExp(
    "^\\s*[\\d\\w\\.]+@[\\d\\w\\.]+\\.[\\w]+\\s*$",
    "i");
  if (theForm) {
    if (theForm["name"]
    && ! nameRE.test(theForm["name"].value)) {
      theForm["name"].focus();
      alert("Please enter your Name");
      return false;
    }
    if (theForm["email"]
    && ! emailRE.test(theForm["email"].value)) {
      theForm["email"].focus();
      alert("Please enter your Email");
      return false;
    }
  }
  return true;
}
//-->
</script>

<form method="post" onSubmit="return verifyForm(this);"
  action="http://yourdomain/autoresponder">
Name: <input name="name">
Email: <input name="email">
<input type="submit">
</form>

Copy the codes on yellow background and paste into your opt-in page. Change the name and email field-names (in red) with the field-names of your real form.

 

by Michel Komarov, © Copyright 2007. iCoder.com

 

Share in social bookmarking:These icons link to social bookmarking sites where readers can share and discover new web pages.  digg del.icio.us BlinkList Reddit NewsVine YahooMyWeb co.mments

Related Articles:

Got a question?   Leave a Reply

You must be logged in to post a comment.