Announcement

Collapse
No announcement yet.

Email address validation on standard checkout email field

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

    Email address validation on standard checkout email field

    There are occasions when a customer can mistype their email address into the standard email field within the site checkout and this will not be picked up meaning that emails may not be sent.

    It is possible to add code to the order script to validate the email address format so that simple errors can be avoided.

    To do this go to your site folder and locate the file: -

    OrderScript.pl

    and open it in a plain text editor (such as 'Notepad' or similar).

    Search for the following line: -

    Code:
    $$pHash{$sKey} !~ /\@/)
    which should take you to the following line: -

    Code:
    $$pHash{$sKey} !~ /\@/)                     # and it is not in the expected format
    replace this with the following code: -

    Code:
    $$pHash{$sKey} !~ /^([a-zA-Z0-9_'+*$%\^&!\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9:]{2,4})+$/) # and it is not in the expected format
    Save the file and close it, then run the command 'Web | Refresh Website' to rebuild the online site files.
Working...
X