Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Using Javascript to confirm email address?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #21  
Old 10-18-2005, 03:00 PM
 
Loon Loon is offline
 

Member
  
Join Date: Feb 2004
Location: MN, USA
Posts: 19
 

Default

We've had several problems with the regular expression that checks if the email is valid --
I changed in skin1/check_email_script.tpl and skin1/check_gcemail_script.tpl, this line:
New Code to replace old:
Code:
var goodEmail = field.value.search(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/gi);

The first reiteration of this check would not allow someone with a 2 character email to register (invalid email address for ed@somewhere.net)

I tweaked it a little and then heard from a customer on RedHat Linux, Netscape 7.1, that it wouldn't allow her to register AND no error - the submit button just didn't do anything. I loaded up the browser on Fedora and sure enough, there was a javascript error. It worked fine in Netscape 7.1 on a Windows box ... weird.

Anyway, the above will allow a 1 character email name, a 1 character domain (a.com if it existed) and ed@somewhere.ca can now register.

Give yours a try on Linux with Netscape 7.1 if you can, or try to create a profile using a two character user name ... you may have the same problem.
__________________
Linux / Apache 1.3.31
PHP 4.3.3
MySQL 4.0.18
X-Cart 3.5.4 in production Mar 08, 2004
X-Cart 3.5.4 Win2k SP4 for development
Reply With Quote
  #22  
Old 10-18-2005, 09:46 PM
 
sanj-xcart sanj-xcart is offline
 

Member
  
Join Date: Sep 2005
Location: London, UK
Posts: 28
 

Default

Thanks for the tips.

I didn't have problems registering a 2 character email address (perhaps they have modified the regex code since 3.5), but I'm unable to check the second problem involving Netscape 7.1.

Definitely something to be aware of. Thanks.
__________________
X-Cart Gold 4.0.16, 4.0.17
X-AOM 4.0.16, 4.0.17
X-Affiliate 4.0.16, 4.0.17
Reply With Quote
  #23  
Old 04-05-2006, 07:36 AM
 
sunny sunny is offline
 

Advanced Member
  
Join Date: Mar 2005
Location: Lakewood, Colorado
Posts: 38
 

Default email verification

Don't know if anyone monitors past threads but here goes...

I used this portion of code on a version 4.0.12 cart and while it works great - thanks so much - I wonder what all the other code in check_email_script.tpl that was replaced was doing. Was replacing all this code still the correct thing to do?

Thanks in advance.

Sunny
__________________
4.1.9
Reply With Quote
  #24  
Old 11-28-2006, 07:21 PM
 
jcasella jcasella is offline
 

Member
  
Join Date: Sep 2003
Posts: 11
 

Default Re: Using Javascript to confirm email address?

Hi,

I know this is an old topic, but I wanted to write in to say THANK YOU to Boomer, Loon, and GM for supplying these mods with such straightforward instructions. This is a feature we've been dreaming of, and will be a huge help in accidental email address typos with our customers. More Egoods will now find their rightful owners.

Thanks again!
__________________
Jim
Tapspace Publications
X-Cart Gold 4.0.19
web host: Lunarpages (linux)
email host: Simplicato
webstore: http://www.tapspace.com/store
Reply With Quote
  #25  
Old 08-26-2010, 06:05 AM
 
eLuminateMedia eLuminateMedia is offline
 

Member
  
Join Date: May 2010
Posts: 23
 

Default Re: Using Javascript to confirm email address?

Quote:
Originally Posted by B00MER
First edit skin1/check_email_script.tpl, replace its entire contents with:

Code:
{* $Id: check_email_script.tpl,v 1.6.2.2 2004/03/26 09:47:33 svowl Exp $ *} {literal} <script language="JavaScript1.2"> function checkEmailAddress(field) { var goodEmail = field.value.search(/^[A-Za-z0-9]{1}([A-Za-z0-9_\-\.]+)[^\.]\@[^\.]([A-Za-z0-9_\-\.]+\.)+[A-Za-z]{2,6}[ ]*$/gi); if (goodEmail!=-1) { if(field.value==document.registerform.emailtwo.value) { return true; } else { alert("Email's do not match, please correct!"); document.registerform.emailtwo.focus(); document.registerform.emailtwo.select(); return false; } } else { {/literal} alert("{$lng.txt_email_invalid|replace:"\n":" "|replace:"\r":" "}"); {literal} field.focus(); field.select(); return false; } } </script> {/literal}

Now open up skin1/main/register_contact_info.tpl and underneath the email table row (</tr>) add this:

Code:
<tr valign=middle> <td align=right>Validate {$lng.lbl_email}</td> <td><font class=Star>*</font></td> <td nowrap> <input type=text name=emailtwo size=32 maxlength=128 value="{$userinfo.email}"> </td> </tr>

This way your not inserting two emails into the database but rather making sure the user has entered the same values into the email field incase of misstypes. All javascript based.

Above code was written with 3.5.x

I can't seem to get this working any ideas what I might be doing wrong, I am quite new to Xcart but have been a web designer for some time.
I have checked a few times and seem to be following everything fine. I don't see the extra field etc.
__________________
Version 4.3.1
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:57 PM.

   

 
X-Cart forums © 2001-2020