Simonantonanton Posted January 11, 2010 Share Posted January 11, 2010 I would like to validate the zip code with a maximum of 6 characters.Does anyone knows how to do that? Example:1234XX 1234 XX should not be possible.This is necessary for Track & Trace in The Netherlands. Link to comment Share on other sites More sharing options...
DutchCoding Posted January 20, 2010 Share Posted January 20, 2010 alleen 6 character in postcode met nederlandse postcode validatie.Stap1. verkort de postcode veldIn global.css(van je huidige theme) helemaal aan de einde van dit bestand plakkenglobal.css : form#account-creation_form input.text#postcode{ width:4em; } Stap2. Maximaal 6 charactersin "authentication.tpl" (van je huidige theme) zoek dit code: -- @ regel 144+/-zoek : {l s='Postal code / Zip code'} <input type="text" class="text" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" /> * en voeg bij input: maxlength="6" {l s='Postal code / Zip code'} <input maxlength="6" type="text" class="text" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" /> * Stap 3. Valideer 4 nummers 2 lettersIN validation.php vervang the huidige "static public function isPostCode($postcode)" functie met: static public function isPostCode($postcode) { return preg_match('/^[1-9][\d]{3}\s?(?!(sa|sd|ss|SA|SD|SS))([a-eghj-npr-tv-xzA-EGHJ-NPR-TV-XZ]{2})$/ui', $postcode); } MVG,DutchCoding Link to comment Share on other sites More sharing options...
Simonantonanton Posted January 20, 2010 Author Share Posted January 20, 2010 GEWELDIG! top man. Hoe weet je dat allemaal?Ik durf het bijna niet te vragen, maar ik wil geboortedatum eigenlijk ook verplichten.Weet je hoe dat moet? Link to comment Share on other sites More sharing options...
Simonantonanton Posted January 20, 2010 Author Share Posted January 20, 2010 Ik heb het zojuist aangepast in de productie (oeps gevaarlijk) en getest.En het werkt!!!Hier ben ik blij mee man.Hopelijk lukt het je ook nog op de geboortedatum te verplichten.Geen noodzaak hoor, maar zou wel aardig zijn. Link to comment Share on other sites More sharing options...
DutchCoding Posted January 20, 2010 Share Posted January 20, 2010 Een makkie voor validatie:in customer.phpga naar line +/- 73 protected $fieldsRequired = array('lastname', 'passwd', 'firstname', 'email'); vervang met protected $fieldsRequired = array('lastname', 'passwd', 'firstname', 'email','birthday'); En voor de sterretje:in Authentication.tpl zoek regel +/- 100: {l s='Birthday'} - {foreach from=$days item=day} {$day|escape:'htmlall':'UTF-8'} {/foreach} {* {l s='January'} {l s='February'} {l s='March'} {l s='April'} {l s='May'} {l s='June'} {l s='July'} {l s='August'} {l s='September'} {l s='October'} {l s='November'} {l s='December'} *} - {foreach from=$months key=k item=month} {l s="$month"} {/foreach} - {foreach from=$years item=year} {$year|escape:'htmlall':'UTF-8'} {/foreach} voeg net boven de " < /p>" tag de "*" toe: {l s='Birthday'} - {foreach from=$days item=day} {$day|escape:'htmlall':'UTF-8'} {/foreach} {* {l s='January'} {l s='February'} {l s='March'} {l s='April'} {l s='May'} {l s='June'} {l s='July'} {l s='August'} {l s='September'} {l s='October'} {l s='November'} {l s='December'} *} - {foreach from=$months key=k item=month} {l s="$month"} {/foreach} - {foreach from=$years item=year} {$year|escape:'htmlall':'UTF-8'} {/foreach} * En dan ben je klaar mvg,DutchCoding Link to comment Share on other sites More sharing options...
Grace26 Posted January 20, 2010 Share Posted January 20, 2010 Thank you a lot for the really good release like this topic. Could you help to look for the thesis writing service or dissertation writing service to purchase the thesis title at? Link to comment Share on other sites More sharing options...
Simonantonanton Posted January 20, 2010 Author Share Posted January 20, 2010 Ik ben d'r wederom blij mee! Zojuist aangepast.You're great man. Link to comment Share on other sites More sharing options...
tpj Posted October 22, 2015 Share Posted October 22, 2015 alleen 6 character in postcode met nederlandse postcode validatie. Stap1. verkort de postcode veld In global.css(van je huidige theme) helemaal aan de einde van dit bestand plakken global.css : form#account-creation_form input.text#postcode{width:4em;} Stap2. Maximaal 6 characters in "authentication.tpl" (van je huidige theme) zoek dit code: -- @ regel 144+/- zoek : <p class="required text"> <label for="postcode">{l s='Postal code / Zip code'}</label> <input type="text" class="text" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" /> <sup>*</sup> </p> en voeg bij input: maxlength="6" <p class="required text"> <label for="postcode">{l s='Postal code / Zip code'}</label> <input maxlength="6" type="text" class="text" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" /> <sup>*</sup> </p> Stap 3. Valideer 4 nummers 2 letters IN validation.php vervang the huidige "static public function isPostCode($postcode)" functie met: static public function isPostCode($postcode) { return preg_match('/^[1-9][\d]{3}\s?(?!(sa|sd|ss|SA|SD|SS))([a-eghj-npr-tv-xzA-EGHJ-NPR-TV-XZ]{2})$/ui', $postcode); } MVG, DutchCoding This SOLVED my problem in PS 1.6 and I do not even speak the same language Without maxlength="5" users can input 6+ characters (12345-6789 which is technically correct in the US) and it will cause the uspscarrier module to fail to show USPS as an option for shipping. This fixed it. Thank You! Link to comment Share on other sites More sharing options...
Recommended Posts