5 ms·
Not every aspect of this is easy, true, but that's no reason not to tackle the ones that are. It's trivial to simply not require a state or a postcode or try to
by gn 17y ago
Not every aspect of this is easy, true, but that's no reason not to tackle the ones that are. It's trivial to simply not require a state or a postcode or try to verify a phone no if the user selects a country other than the US.
There should be a library for this. We have libraries that can handle the insanely capricious details of DST for all countries and subnational entities on the planet; we should have no problem providing one list of states and two regular expressions per nation.
(I know it's more or less impossible to reliably catch (e.g.) invalid UK postcodes, but we wouldn't have to. We'd mainly want to catch obvious typos without making things needlessly hard for customers overseas.)
- Timmy_C 17y agoWufoo is pretty good for pre-made forms. And they advertise that they can do US and International phone, mail and currency fields.