conditional numerical input

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
User avatar
baudwalker
Veteran Member
Posts: 188
Joined: 2015-02-03 08:08
Location: Bellingen NSW Australia

conditional numerical input

Post by baudwalker » 2021-03-05 02:34

Hi All,
I want the input to be between 1000000000 and 999999999. In other words to have only 10 digits. If possible I would prefer to use a hooks file.

Regards Barry

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: conditional numerical input

Post by pbottcher » 2021-03-05 06:51

Hi Barry,

you can add to the TABLENAME-dv-js something like

Code: Select all

$j(function(){
$j('#FIELDID').attr('pattern','[1-9]{1}[0-9]{9}');
})
Replace FIELDID with the fieldname you are targeting.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

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

Re: conditional numerical input

Post by baudwalker » 2021-04-08 00:10

absolutely brilliant, thank you. The next trick is to change the default error message.

I tried to add [ setCustomValidity('custom messageer') ] without success. its just a matter knowing where to plonk things.

Barry

Post Reply