Variable Input Mask?

Stranger

New Member
I have a little problem which is more of an academic curiosity at this point than anything else, since there are ways around it. But I would like to know whether it can be done.

On a form I have address details which could be from either the USA or Canada (with more countries to be added soon, hopefully). Everything is necessarily in dropdown: choice of country, state or province, and so forth. When I started it was only the US, so I put an input mask on the zip code suitable for the numeric 5+4 format. But the Canadian postal code is a six character string as is the UK's and I would like that field to accommodate both formats but still maintain the validation inherent in input masks.

So I now have the option of having two separate, but adjacent, input fields for the zip code and postal code and let the user choose.

Or I was thinking maybe I could use cascading dropdown with the country as the watch element where the choice would display an appropriate input mask in the zip code field. I know that dropdown elements display values or labels or any column from the database table in question, but could that column actually be an input mask?

How about regex or Ajax validation (which I have never used)? or is there other code that I can use to achieve that end?

Best regards
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top