Inputmask

Posted: 2017-01-17 in Inputmask

Q:
I have a textbox placed in a canvas section that is to display a Canadian Postal Codes.
If I have the mask set as: A9A9A9 it does work however, how do I set the mask to accept a space: A9A 9A9?

I’m assuming a regular expression would work better although I’m not sure how to add the space (I believe it’s used as \s).
I’m guessing it would be something similar to ?[A-Za-z]{1}[0-9]{1}[A-Za-z]{1}[0-9]{1}[A-Za-z]{1}[0-9]{1}.
Any other suggestions on how to handle a postal code
A:
For the space in the regular expression, you can just include a space. I came across this one, which looks like the sort of thing you need, although if you want to allow lower case, you’ll have to add that in.

?[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d

That one apparently takes into account that not all of A-Z are valid starting characters.

Make sure you set a default, e.g. space(7) if it is not data bound.
the ‘?’ prefix is added for Lianja to indicate that the mask is a regular expression

Code:
?^((\d{5})|(([ABCEGHJKLMNPRSTVXY]|[abceghjklmnprstvxy])\d([ABCEGHJKLMNPRSTVWXYZ]|[abceghjklmnprstvwxyz])(\s|)\d([ABCEGHJKLMNPRSTVWXYZ]|[abceghjklmnprstvwxyz])\d))$

For anyone else following along, here is a regular expression that should handle most current zip codes or postal codes (case insensitive although UPPER CASE is the standard method).

Code:
?^(((\d{5})(?:[-\s]*(\d{4})))|(([ABCEGHJKLMNPRSTVXY]|[abceghjklmnprstvxy])\d([ABCEGHJKLMNPRSTVWXYZ]|[abceghjklmnprstvwxyz])(\s|)\d([ABCEGHJKLMNPRSTVWXYZ]|[abceghjklmnprstvwxyz])\d))$

[EDITED] see next Cory’s post:

Regular expression input masks are not supported in Web/Mobile Apps.


issue with the Currency mask in a Grid Section Column was resolved in a subsequent release.



Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s