format phone number input

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
User avatar
baudwalker
Veteran Member
Posts: 114
Joined: 2015-02-03 08:08
Location: Bellingen NSW Australia

format phone number input

Post by baudwalker » 2019-08-13 10:42

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

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 553
Joined: 2018-04-01 10:12

Re: format phone number input

Post by pböttcher » 2019-08-21 18:13

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}');

User avatar
baudwalker
Veteran Member
Posts: 114
Joined: 2015-02-03 08:08
Location: Bellingen NSW Australia

Re: format phone number input

Post by baudwalker » 2019-08-21 22:40

Thank you I will give it a try

Post Reply