Announcement

Collapse
No announcement yet.

Validation of email address

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Validation of email address

    Hi there

    I wonder whether anyone can help. I want to update OrderScript.pl so that it validates the email address that the user enters with their invoice details. At the moment all that is checked is that the field is not empty. I want to make sure that the email address is in the correct format (with @ sign, at least one '.', etc).

    Any help would be much appreciated

    Thanks

    Jon

    #2
    There are previous posts on both perl and javascript options for this. Try searching the fourm and I'm sure you'll find something.

    Mike
    -----------------------------------------

    First Tackle - Fly Fishing and Game Angling

    -----------------------------------------

    Comment


      #3
      Thanks for your reply Mike. I searched through the forums for about an hour and the only post I found that partly answered my question related to v8.

      It suggested replacing
      $::g_BillContact{'EMAIL'} !~ /\@/)
      with
      $::g_BillContact{'EMAIL'} !~ /^([a-zA-Z0-9_'+*$%\^&!\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9:]{2,4})+$/)

      The trouble is that the original line of code doesn't exist in the v6 orderscript.pl and I'm not sure where to put it if anywhere.

      Comment


        #4
        Hi Jon,

        I've found something in our v8 Advanced User Guide for asking a customer to enter their email address twice and they can't continue until both addresses are the same - I don't know if this would help. I've managed to convert it for v6 use so you would need to do the following:

        - go to the 'Advanced' menu and select 'Template Manager'
        - click on the 'Ordering' tab and then on the 'Order Phase 1' button
        - locate:

        <input type="TEXT" name="INVOICEEMAIL" size="20" maxlength="255" value="NETQUOTEVAR:INVOICEEMAIL">

        - replace this with:

        Code:
        <!--<input type="TEXT" name="INVOICEEMAIL" size="20" maxlength="255" value="NETQUOTEVAR:INVOICEEMAIL">-->
        <input type="TEXT" name="INVOICEEMAIL" id="email1" size="20" maxlength="255" value="NETQUOTEVAR:INVOICEEMAIL">
        <!-- start Check email address -->
              <br>
              Repeat email address:
              <br>
              <input type="TEXT" name="DUMMY" id="email2" size="20" maxlength="255" value="NETQUOTEVAR:INVOICEEMAIL">
        <script language=JavaScript>
        <!--
        function checkemailaddress()
          {
          if ( document.getElementById('email1').value != document.getElementById('email2').value )
            {
            alert('The Email addresses do not match');
            return false;
            }
        return true;
        }
        // -->
        </script>
        <!-- end Check email address -->
        Then locate:

        <input type=SUBMIT name=ACTION value="NETQUOTEVAR:NEXTBUTTON">

        and replace it with:

        <input type="submit" name="ACTION" value="NETQUOTEVAR:NEXTBUTTON" onclick="return checkemailaddress()" />
        <!--<input type=SUBMIT name=ACTION value="NETQUOTEVAR:NEXTBUTTON">-->

        - close and save the file and update your site to see it working.

        I hope this helps.
        ********************
        Tracey
        SellerDeck

        Comment


          #5
          Still plodding on with V5 so would the V6 code work for V5?

          About 20% of orders come in with the wrong email addresses, bloody annoying.

          Andrew
          Jewellery247.co.uk
          AndrewBerry.com

          W: http://www.WelshGoldOnline.co.uk
          W: http://www.jewellery247.co.uk
          W: http://www.AndrewBerry.com

          Comment


            #6
            Hi,

            Still plodding on with V5 so would the V6 code work for V5?
            Yes, it should work for v5 too.
            ********************
            Tracey
            SellerDeck

            Comment


              #7
              It should be simple to extend the JavaScript solution above to check the email address. A quick google for "javascript validate email address" will return many examples.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment

              Working...
              X