Field element - mask definitions query

BasilC

Member
I have a field which stores a UK landline phone number. The vast majority of these numbers are on London exchanges and have the format 020 9999 9999, where 9 is any digit, but a few are outside London and have the format 01999 999999.

I'm using the mask 999 9999 9999 so that the gaps are automatically placed in the right places for London numbers. Because I have Format string on blank field set to Yes, the shorter non-London numbers are accepted, but the space is put in the wrong place.

Could I use Mask definitions to overcome this? If so, how, I don't really understand the instructions!

Grateful for any advice.
 
I don't think mask definitions will work. The plugin we use just doesn't handle alternate formats.

I've been thinking about moving to this library:

https://github.com/RobinHerbots/Inputmask

... which provides much more functionality, including alternate masks, and predefined mask libraries (including US and UK phone numbers), but it would be a backward compat breaking change, and it's not a trivial undertaking. So ... one of these days, but not right now.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top