code for a dynamic postal address entry form/database structure for both US and International addresses

6 posts by 2 authors in: Forums > CMS Builder
Last Post: June 18, 2017   (RSS)

By gkornbluth - June 3, 2017

Hi all,

I’ve been looking in the forum and the web, and haven’t been able to come up with an appropriate answer.

Has anyone been working on the code for a dynamic postal address entry form/database structure that works for both US and International addresses that they'd be willing to share?

I’d like to be able to select a country from a list and have the address input form automatically display, rename, and hide the appropriate fields for postal addresses in that country, IE: Provinces for Canada, States for US, etc., and any other differing fields.

It would be great if the error checking/validation took into account the differences as well. IE: 6 Alpha numeric characters and spaces in the Postal code for Canada, 5 digit zip for the US, etc.

All I've been able to find on this topic are the state and country tables posted at https://www.interactivetools.com/forum/forum-posts.php?postNum=2213742

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By Dave - June 17, 2017

Hi Jerry, 

I saw this post from a couple weeks ago didn't have a reply yet.  Did you find a solution?

In general, there's no universal standardized format for international addresses.  We've always just used the generic fields, sometimes with "State/Province" displayed for the text.  As this is pretty universal users usually know what/where to fill out.  

Let me know if you got this sorted out and/or what you're trying to accomplish.

Thanks!

Dave Edis - Senior Developer
interactivetools.com

By gkornbluth - June 18, 2017

Hi Dave,

Thanks for catching this one.

I’m working with a small non-profit mental health directory startup that eventually wants to expand to offering their directory in a number of countries.
    
I’ve seen a number of Postal Code validation schemes for various country formats, and also some fairly sophisticated country aware drop downs (like state lists for USA, and Provence lists for Canada and many other major countries) in some of the major shopping carts, and had hoped that some enterprising PHP programmer had worked out some code, so that I wouldn’t have to re-invent the wheel as the directory expands it's reach.

Best,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By Dave - June 18, 2017

Oh, I see.  So you want consistent state/city names (not text entered freeform) so that you can group and list them by those states/cities?  Is that right?

In any case, try this Google search.  There's a some resources linked/listed from the first few results.
https://www.google.com/search?q=programmer+list+of+states+provinces+by+country

And there's some more information here as well:
https://www.google.com/search?q=univeral+address+form

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

By Dave - June 18, 2017

Thanks!  You too! :-)

Dave Edis - Senior Developer
interactivetools.com