No announcement yet.

Anyone recommend a email validation script for a Form?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Anyone recommend a email validation script for a Form?

    Hi there,

    I used cgiemail and made a form that allows potential people to schedule an appointment, but I need to validate the email address that people enter.

    I see that there are quite a few scripts out there but some are better than others. Do you have a suggestion for a script, or a good way to validate?

    thanks much

  • #2
    The following Script can be added to your webpage that includes form which would be asking for an email id. Note that it must be added to the head section of the webpage

    <script type="text/javascript" src="email.js">
    Then you must call it making use of the below code based on onclick or onsubmit action :

    valid_email =
    The entered email id should pass in place of email_field in the code above. If its a mandatory field you must set the field as 1 else as 0.

    You may also include an if statement in the validation code which would validate a mandatory email field:
    if (!validateEmail(emailfield,1,0)) {
    alert('invalid email id  or please enter an email id');
    return false;}
    Hope it helps


    • #3
      The above suggestion may do the job for you but I can suggest a script that I've been using for a few years now - formtoemailpro

      There's a perfectly good free version and a pro version (I now have) which gives you more features and is easy to use.

      I have no vested interest - simply a great script which I use a lot and the owner has been excellent at answering questions/suggestions when I've wanted to 'tweak' things!

      Hope that helps


      • #4
        As far as I know there is no reliable way to validate an email address other than to try sending an email to it. There are simple checks that can weed out obviously invalid addresses though.

        This javascript code will weed out obvious bad addresses, won't reject any valid ones but may sometimes accept an invalid address.

        var re = new RegExp("^[^ @][email protected][^ @]+\.[^ @]+$");
        if (document.getElementByID( "email_field" ).value.match(re)) {
        alert("Email Accepted");
        } else {
        alert("Email Rejected");