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
  #11  
Old 05-26-2004, 02:00 PM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

It's friggin' scary how smart you guys are! Especially you BOOMER (where were you born? Earth?)
And thanks Loon for thinking of guys like me
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote
  #12  
Old 05-26-2004, 02:44 PM
 
Loon Loon is offline
 

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

Default

Thanks, but if you think I'm so smart (2nd smartest, of course, and I accept that Very Gracefully), why can't I apply the upgrade from 3.5.4 to 3.5.6 without losing all the images? It's about to drive me around the bend!

I've probably been doing this sort of stuff since before you were born, unfortunately, so if it weren't for the Smarty templates, it would all be a breeze. Hard to teach an old dog new tricks.

Glad, though, that someone appreciates the easy directions.

J. a.k.a. Loon

P.S. since my previous post here, I've installed in production, created a profile, modified it, bought a gift cert and deleted the profile and everything works flawlessly [she said].
__________________
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
  #13  
Old 05-26-2004, 03:53 PM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

UPDATE: Something in the check_email_script.tpl is causing the gift cert part not to funtion at all in 3.5.7. ie: when you click submit... nothing.
Or should I say that the GC part in 3.5.7 is somehow relying on check_email_script.tpl when it should be relying on check_gcemail_script.tpl ??? I better try this again.

2nd UPDATE: Nope, it's not me, BOOMERS side is working but the GC side isn't working in 3.5.7
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote
  #14  
Old 05-26-2004, 05:12 PM
 
Loon Loon is offline
 

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

Default

If it would help, I can send you my two files that I altered for the gift cert stuff and you can do a file compare .... since I'm still on 3.5.4, something else may be in play here.... let me know. J.
__________________
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
  #15  
Old 05-26-2004, 05:16 PM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

Ok... found it! In v3.5.7 you also need to change line 46 in giftcert.tpl from:
Code:
if (!checkEmailAddress(document.gccreate.recipient_email))

To:

Code:
if (!checkGCEmailAddress(document.gccreate.recipient_email))

Works awesome you guys! Great Mod! should be standard in the cart.
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote
  #16  
Old 05-27-2004, 04:25 AM
 
Loon Loon is offline
 

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

Default

Hey, good catch. We allow people to order gift certs to be mailed to them (US Postal mail) so I think that's why I never hit the piece of code you fixed.

This needs to be fixed in version 3.5.4 also.

Together, we can do it! J.
__________________
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
  #17  
Old 05-27-2004, 07:37 AM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

Small revision (cleans it up a bit)

in skin1/modules/Gift_Certificates/giftcert.tpl

"around line 203, ADD the second email field to the gift certificate purchase form, with a few changes from the one in the registration form:"

Changed to:
Code:
<tr> <td nowrap align=right>Validate {$lng.lbl_email}</td> <td><font class=Star>*</font></td> <td nowrap> <input type=text name=emailtwo size=30 value="{$giftcert.recipient_email}"> </td> </tr>
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote
  #18  
Old 06-07-2004, 04:02 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

Updated check_email_script.tpl this should prevent any problems with Gift Certificates as well as Affiliate registrations also:

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(document.registerform.emailtwo) { 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 { return true; } } else { {/literal} alert("{$lng.txt_email_invalid|replace:"\n":" "|replace:"\r":" "}"); {literal} field.focus(); field.select(); return false; } } </script> {/literal}
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #19  
Old 10-13-2005, 02:27 PM
 
sanj-xcart sanj-xcart is offline
 

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

Default

This is invaluable, thanks all. I'm working with 4.016, so I couldn't directly copy the code above. My check_email_script now looks like the following (bold was added to original):

Code:
{* $Id: check_email_script.tpl,v 1.11.2.6 2004/11/22 09:16:26 max Exp $ *} {literal} <SCRIPT type="text/javascript" language="JavaScript 1.2"> function checkEmailAddress(field, empty_err) { var err = false; var res, x; if(!field) return true; if(field.value.length == 0) { if(empty_err != 'Y') return true; else err = true; } var arrEmail = field.value.split('@'); if(arrEmail.length != 2 || arrEmail[0].length < 1) err = true; if(!err) { if(arrEmail[0].length > 2) res = arrEmail[0].search(/^[-\w][-\.\w]+[-\w]$/gi); else res = arrEmail[0].search(/^[-\w]+$/gi); if(res == -1) err = true; } if(!err) { var arr2Email = arrEmail[1].split('.'); if(arr2Email.length < 2) err = true; } if(!err) { var domenTail = arr2Email[arr2Email.length-1]; var _arr2Email = new Array(); for(x = 0; x < arr2Email.length-1; x++) _arr2Email[x] = arr2Email[x]; arr2Email = _arr2Email; var domen = arr2Email.join('.'); res = domen.search(/^[-!#\$%&*+\\\/=?\.\w^`{|}~]+$/gi); if(res == -1) err = true; res = domenTail.search(/^[a-zA-Z]+$/gi); if(res == -1 || domenTail.length < 2 || domenTail.length > 6) err = true; } // /^([-\w][-\.\w]*)?[-\w]@([-!#\$%&*+\\\/=?\w^`{|}~]+\.)+[a-zA-Z]{2,6}$/gi if (err) { alert({/literal}"{$lng.txt_email_invalid|replace:"\n":" "|replace:"\r":" "|replace:'"':'\"'}"{literal}); field.focus(); field.select(); } [b] if(document.registerform.emailtwo) { if(field.value==document.registerform.emailtwo.value){ } else{ alert("Please reconfirm your email address. It does not match."); document.registerform.emailtwo.focus(); document.registerform.emailtwo.select(); err = true; } } [/b] return !err; } </SCRIPT> {/literal}

I followed the second step exactly as above, inserting the following just under the email input in the register_contact_info.tpl file:

Code:
<TR> <TD align="right">{$lng.lbl_confirm_email}</TD> <TD><font class=Star>*</font></TD> <TD nowrap> <input type="text" id="emailtwo" name="emailtwo" size=32 maxlength=128 value="{$userinfo.email}"> </TD> </TR>

Thanks for the great code and tips folks, I really appreciate it.
__________________
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
  #20  
Old 10-13-2005, 02:31 PM
 
sanj-xcart sanj-xcart is offline
 

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

Default

Sorry, I just noticed that bold doesn't show up in code. You will need to extract the bbcode bold tags from the first script if you use it.

Also, I have only used this for standard customer registration. It works there, but I have not tested with Gift Certificates or Affiliates, so please be aware of this.

sanj
__________________
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
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 04:21 PM.

   

 
X-Cart forums © 2001-2020