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

Force Capital letters in Postal Code Field

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 01-12-2004, 06:06 AM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default Force Capital letters in Postal Code Field

Is there a way to force letter characters entered into the postal code field to be capitalised upon form submission?

Ideally I would like to have the form make the correction rather than force the user to re-type the Postal Code.

Canadian and UK Postal Codes use Letter & Number combinations.

It's a pet peeve of mine having to manually go through all of the new user sign ups and fix the postal codes. It was doable with 3 or 4 sign ups a day, but now that I am taking in 12+ a day, it really sucks having to waste the time on this.

Suggestions?
Reply With Quote
  #2  
Old 01-12-2004, 06:51 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

I know you can force the output by adding

|upper after the var name in the templates

http://smarty.php.net/manual/en/language.modifier.upper.php
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #3  
Old 01-12-2004, 06:55 AM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Testing. Thanks.
Reply With Quote
  #4  
Old 01-19-2004, 05:04 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Ok that was not what I was looking for.

I found this snippet on the web

Code:
Add this to your input box: onKeyUp="this.value=this.value.toUpperCase();

But I don't know where to use it in register.tpl.

I also found this and was wondering if anyone could help me twist this example to work somehow.

Code:
<SCRIPT LANGUAGE="JavaScript"><!-- function convert() { document.myForm.myText1.value = document.myForm.myText1.value.toUpperCase(); document.myForm.myText2.value = document.myForm.myText2.value.toUpperCase(); } //--></SCRIPT> <FORM NAME="myForm" onSubmit="convert()"> <INPUT TYPE="TEXT" NAME="myText1"> <INPUT TYPE="TEXT" NAME="myText2"> <INPUT TYPE="SUBMIT"> </FORM>

The thing is, I am an idiot when it comes to Javascript. I don't even know where to start or basic rules of syntax.

Puleeze help the Boss free his time.
Reply With Quote
  #5  
Old 01-21-2004, 07:50 AM
 
blue-dreamer blue-dreamer is offline
 

eXpert
  
Join Date: Dec 2002
Location: Northampton UK
Posts: 213
 

Default

You could modify the text box using CSS to display capital letters..

try..

font-variant: small-caps

or

text-transform: capitalize
Reply With Quote
  #6  
Old 01-21-2004, 08:46 AM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Thanks for the response (I didn't think anyone cared about this).

I am looking to force the text input for the billing postal code and shipping postal code into the database as Caps.

So either it gets corrected on screen before submission or corrected during the submission process. Frankly I don't care, but business keeps snowballing and I really don't have the time to correct little things like this.

Plus this would be nice to have on the board for future needs.

Anyone? I'm sure one of my javascript examples will work, I just don't know how to implement it.
Reply With Quote
  #7  
Old 01-21-2004, 09:07 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

Here you go,

clever little trick that. I did this for V3.5.3 but youll see the idea of how it works for any other version.

This is the code for the zip code part of the registration form

Code:
<tr valign=middle> <td align=right>{$lng.lbl_zip_code}</td> <td><font class=Star>*</font></td> <td nowrap> <input type=text name=b_zipcode size=32 maxlength=32 value="{$userinfo.b_zipcode}" onKeyUp="this.value=this.value.toUpperCase()" onChange="check_zip_code()" > {if $reg_error ne "" and $userinfo.b_zipcode eq ""}<font class=Star>&lt;&lt;</font>{/if} </td> </tr>
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #8  
Old 01-21-2004, 09:33 AM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Be sure to update the shipping zip code area of register.tpl as well. That way manual shipping addresses gets updated too!



Thanks Shan. Works like a charm.

I can't seem to find a donate link for you.

Anyway, you will want to add this to the Custom Mods Forum I would hope.
Reply With Quote
  #9  
Old 01-21-2004, 09:39 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default

Nice one Shan, handy.
Reply With Quote
  #10  
Old 01-21-2004, 02:57 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

Quote:
Originally Posted by adpboss
Thanks Shan. Works like a charm.

I can't seem to find a donate link for you.

glad to help

http://forum.x-cart.com/viewtopic.php?t=879
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 08:36 AM.

   

 
X-Cart forums © 2001-2020