sh8dy1041 Posted August 24, 2015 Share Posted August 24, 2015 Hi, I am having issue with the postcode validation within the customer registration stage. I have changed the postcode validation option in the back office so that a customer can submit a postcode of any type but whenever a postcode is inserted, a red X is shown in the box as if it is invalid. The customer is still able to submit their address but the box shows as if it has an incorrect input.] We have postcodes such as WA1 1AA WW11 1AA W1 1AA As i say, I have removed all validation from within the back office but somewhere, there is still something happening because when I type an american zip code in, it shows as being correct. The postcode is required and the validation box is empty within Location > Countries > (My selected country) Kind Regards Chris Link to comment Share on other sites More sharing options...
sh8dy1041 Posted August 24, 2015 Author Share Posted August 24, 2015 I have just found within the validate.js file the following code and removed it. function validate_isPostCode(s, pattern, iso_code) { if (typeof iso_code === 'undefined' || iso_code == '') iso_code = '[A-Z]{2}'; if (typeof(pattern) == 'undefined' || pattern.length == 0) pattern = '[a-z 0-9-]+'; else { var replacements = { ' ': '(?: |)', '-': '(?:-|)', 'N': '[0-9]', 'L': '[a-zA-Z]', 'C': iso_code }; for (var new_value in replacements) pattern = pattern.split(new_value).join(replacements[new_value]); } var reg = new RegExp('^' + pattern + '$'); return reg.test(s); } Now I have removed it the red X doesn't show. Does anyone know if removing this will cause problems elsewhere? Kind Regards Chris Link to comment Share on other sites More sharing options...
mijosh Posted August 31, 2015 Share Posted August 31, 2015 Thanks mate you saved a lot of time Link to comment Share on other sites More sharing options...
andreacasirry Posted September 15, 2015 Share Posted September 15, 2015 I changed the file themes/theme-default/address.tpl at line 103. I deleted "validate" original file: <input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" id="postcode" name="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{else}{if isset($address->postcode)}{$address->postcode|escape:'html':'UTF-8'}{/if}{/if}" /> changed file <input class="is_required form-control" data-validate="{$address_validation.$field_name.validate}" type="text" id="postcode" name="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{else}{if isset($address->postcode)}{$address->postcode|escape:'html':'UTF-8'}{/if}{/if}" /> Link to comment Share on other sites More sharing options...
djpat99 Posted October 27, 2015 Share Posted October 27, 2015 (edited) Hi all, I am trying to sort this problem too. I have tried andreacasirry solution but it hasn't worked. I am weary of using sh8dy1041 solution too as won't it cause problems when the function is called? Edited October 27, 2015 by djpat99 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts