Page 1 of 1

Restrict Field input

Posted: 2022-03-08 10:58
by angus
Hi everyone, is it possible to restrict the input into a field so that it must start with the letters 'OI' or 'OID' ?

Re: Restrict Field input

Posted: 2022-05-23 13:40
by angus
anyone help guide me with this?

Re: Restrict Field input

Posted: 2022-05-23 16:01
by Alisson
Try this in your tableName-dv.js:

Code: Select all

$j("#fieldName").attr("pattern", "OI.*");

Re: Restrict Field input

Posted: 2022-05-23 16:44
by angus
Thanks Alisson, nothing happens when I added this to the -dv.js file. I typed in ggfhfg and it let me save it ok?

Re: Restrict Field input

Posted: 2022-05-23 16:49
by angus
Alisson, I just refreshed the page and it worked. is there a way to amend the message that pops up?
example.png
example.png (4.35 KiB) Viewed 2672 times

Re: Restrict Field input

Posted: 2022-05-24 09:43
by angus
Alisson I found a solution to this, I added a title to the input tag on the DV templates file and it now comes through with a much easier to understand error. Only issue is that I will need to remember to update this on any changes.

appreciate your help

Re: Restrict Field input

Posted: 2022-05-25 13:18
by Alisson
Hi angus, just add another attribute to the code to modify the text.

Code: Select all

$j("#fieldName").attr("pattern", "OI.*").attr("title", "Must start with 'OI' or 'OID'");

Re: Restrict Field input

Posted: 2022-06-10 13:45
by angus
perfect, thanks so much