X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Force Capital letters in Postal Code Field (https://forum.x-cart.com/showthread.php?t=5985)

adpboss 01-12-2004 06:06 AM

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?

shan 01-12-2004 06:51 AM

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

adpboss 01-12-2004 06:55 AM

Testing. Thanks.

adpboss 01-19-2004 05:04 PM

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.

blue-dreamer 01-21-2004 07:50 AM

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

try..

font-variant: small-caps

or

text-transform: capitalize

adpboss 01-21-2004 08:46 AM

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.

shan 01-21-2004 09:07 AM

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>


adpboss 01-21-2004 09:33 AM

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.

PhilJ 01-21-2004 09:39 AM

Nice one Shan, handy.

shan 01-21-2004 02:57 PM

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 :wink:

http://forum.x-cart.com/viewtopic.php?t=879


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

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.