[ic] postcode field in state database
Mike Heins
mike at perusion.com
Tue Apr 12 07:36:04 EDT 2005
Quoting Jeff Fearn (jefffearn at gmail.com):
> Hi, I have been looking in to internationalising validation of
> postcodes and states. Is the states database used for anything? I have
> grepped through the code and not found anything using it.
Yes, it is used for tax in the core and for generating state select dropdowns
in the standard demo.
Coincidentally, I just committed a country_select Widget to CVS which
dynamically switches the state widget based on the country.
>
> I am specifically interested in the current use of the postcode field
> in the state database. I have started using it to hold regular
> expressions to validate postcodes against. I did have to enlarge
> postcode to 32 chars to fit the Canadian re's.
>
> i.e
> 00047 01 CA ON Ontario [KLMNP]\d[A-Za-z] \d[A-Za-z]\d
> 00328 02 AU QLD Queensland [4|9]\d\d\d
> 00150 00 US ME Maine ddddd(?:-?dddd)?
>
> I then modified Order.pm to check the state & postcode using the modified table.
>
> sub _multizip {
> my($ref,$var,$val) = @_;
[snip]
>
> sub _multistate {
> my($ref,$var,$val) = @_;
[snip]
Good idea.
The way to do this is probably to use an OrderCheck code definition
instead of modifying Order.pm. (They take precedence over the ones
defined there.) If you make a compatible one, we can put this in
code/Ordercheck instead of in Order.pm (which is sort of the direction
we are going with this stuff anyway.
>
> Can anyone see this breaking any exisiting or planned future use of
> the state.postcode field?
Not that I can see. Though I imagine one might think of using it for a
list of postcodes to populate a dropdown, I think a "zip" or "postcode"
table makes more sense there.
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.765.647.1295 tollfree 800-949-1889 <mike at perusion.com>
Research is what I'm doing when I don't know what I'm doing.
-- Wernher Von Braun
More information about the interchange-users
mailing list