Page 1 of 1

format phone number input

Posted: 2019-08-13 10:42
by baudwalker
I have used the "data format" section to select the phone number format but that seems to be for display only.
How can the user be forced to use the input format ( 0# #### #### ) as a condition. The phone number is not required but if the user attempts to fill in the phone number field the formatting takes over and must be used.

Barry

Re: format phone number input

Posted: 2019-08-21 18:13
by pbottcher
Hi,

you can add a pattern to the input field.

e.g.

$j('#field').attr("pattern", '0[0-9] [0-9]{4} [0-9]{4}');

Re: format phone number input

Posted: 2019-08-21 22:40
by baudwalker
Thank you I will give it a try