in reply to Re: validate a postal code
in thread validate a postal code

That's US-only though. The OP said that wouldn't be enough.

In general you're not going to be able to solve this problem. There are an awful lot of different address formats (eg compare the US, France and Japan), and there can even be different formats within a single country. Additionally, even if you could find a set of rules for each country, I know full well that the rules you'll get for the UK will be wrong, in that while they might specify what the post office *want* people to use, they will not be anything like what people *actually* use, and which *work*.

And finally, don't even consider relying on a database lookup. There are plenty of addresses in the UK which the post office's database gets wrong, or which aren't even in the database. I live at one such address, and it's very annoying when programmers who really should know better are stupid enough to trust a database generated by a government body!

Replies are listed 'Best First'.
Re^3: validate a postal code
by powerhouse (Friar) on Jul 05, 2008 at 08:43 UTC
    I just need help with validating that it looks right, so if the formula's think it is wrong, I'll just post a confirmation page, that says your address does not look correct, so we need you to validate your input is correct. So please check the box that says "Yes I verify my address is deliverable by our local post office. I will pay re-shipment costs if it is returned." Then if they check the box, I'll just override that and let them get it through.

    Our members do not seem very intelligent though, for instance, one of the fields that one of our gateways asks for is: "nameoncard". Therefore my label read: "Name On Card". We had members put:
    Master Card (as their name)
    and: Visa Card (as their name)

    Those made me LAUGH OUT LOUD, seriously, but that is how un-intelligent that most of them are. I now changed that label to: Cardholder Name. That seemed to fix the problem, so far anyhow...
    I had to make our programming work for a little child, so I have my 10 year old check all my work. If he can understand it, then I figure our precious members can :).

    Still, we get hundreds of helpdesk posts per week for them not understanding how some of the things work. :o( Such is life.

    Anyhow, that is what I am wanting to do, is just 'Check' their entry, because I am having to manually fix some addresses because people are putting "United States" as their country field when they live in Canada, Estonia, Ireland, and one other was New Zealand.

    I will not force people to change it to match any database or fomula, just make them check their entry and then promise it is correct.

    Sorry for the long reply.

    thx,
    Richard
      ...one of the fields that one of our gateways asks for is: "nameoncard". Therefore my label read: "Name On Card". We had members put: Master Card (as their name) and: Visa Card (as their name)

      Note that in your explanation you qualified 'name' as "as their name" to make your point.

      You'd probably get less problems if your label read: "Your name, as shown on the card".

      so I have my 10 year old check all my work. If he can understand it, then I figure our precious members can :).

      And your son's native language is?


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Once I changed that field to say, "Cardholders Name", we have had less problems...

        I have 4 children(10,9,4,1), all speak English and know some American Sign Language (my mom teaches ASL)... I only allow my 2 oldest boys on the internet for about 30 minutes per day, 3 or 4 times per week, depending on their behaviour and chores being done... So they are not internet guru's like some 10 year olds I know... so I figure if they can understand what I'm asking for then so can an adult.

        I don't allow my youngest boy(4) on the computer yet and my only girl is just a baby, so I won't let her on here for years to come... at any rate, I know that my son speaking english as his native language might give him an edge over an adult that speaks english as a second language, or maybe not at all and has to use a translation service...

        I am working on a language tag system so we can convert the english to multiple languages. However, since I did not do that while I was creating the system, it is a major transition. I am creating a database driven system for it, with a control panel which we can give to the people doing the translation, and they will be only logged into the language that we assign to them(Meaning if they are translating the english to Chinese, they cannot edit the Russian tags), and it will show them one tag at a time, with the english above it, the current language tag in an editable form, and a link to the page that it is on so they can see how the words are used...

        That is the easy part, the hard part is going through all my tons and tons of pages and swapping out all the wording with the merge fields for the language tags... sure wish I would have not been 'under the gun' to get this system done, so that I could have done it while I was creating all the code.

        Anyhow, thanks for the response.

        thx,
        Richard