Page 1 of 1

conditional numerical input

Posted: 2021-03-05 02:34
by baudwalker
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

Re: conditional numerical input

Posted: 2021-03-05 06:51
by pbottcher
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.

Re: conditional numerical input

Posted: 2021-04-08 00:10
by baudwalker
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