Jump to content

Registration Form UK Postcode entry issue (FIXED)


Recommended Posts

First off not sure if this is the right place to post so please move if required. I spent 3 hours working this stupid oversight out so I hope it helps any UK users with the same issue.

 

Have spent 3 hours  trying to get a simple Postcode entry on a UK address and no matter what I did it would always show an error, even though I set the format field empty so not to validate. The reason why is the field is forced uppercase so you need to edit the following file

 

js/validate.js

 

and find

 

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-]+';
 
and change it to
 
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-zA-Z 0-9-]+';

 

Now it will validate uppercase letters.

Edited by uknutz (see edit history)
  • Like 3
Link to comment
Share on other sites

  • 5 months later...
  • 5 months later...

I still cannot enter any UK postcode. Both upper and lower case letters are "refused" and I always receive the error message:
*Required field

postcode form box code:

<div class="required postcode form-group  form-error">
<label for="postcode">Zip/Postal Code <sup>*</sup></label>
<input class="is_required validate form-control" data-validate="isPostCode" type="text" id="postcode" name="postcode" value="">
</div>
I've modified js as explained 2 posts above. 
Link to comment
Share on other sites

One more time me. There is a solution to this problem, "brutal" though. It is enough to modify function validate_isPostCode and put

return true;

between the brackets.

Mentioned function can be found in file js/validate.js

There is one danger! EVERYTHING CAN BE PLACED IN THE BOX!
Anybody with skill could talk to me about it? I need to know something about variables: s, pattern, iso_code. PLEASE

Edited by iza997 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...