Restrict Field input

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Restrict Field input

Post by angus » 2022-03-08 10:58

Hi everyone, is it possible to restrict the input into a field so that it must start with the letters 'OI' or 'OID' ?
AppGini 22.13

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Restrict Field input

Post by angus » 2022-05-23 13:40

anyone help guide me with this?
AppGini 22.13

Alisson
Veteran Member
Posts: 81
Joined: 2017-02-25 20:32

Re: Restrict Field input

Post by Alisson » 2022-05-23 16:01

Try this in your tableName-dv.js:

Code: Select all

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

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Restrict Field input

Post by angus » 2022-05-23 16:44

Thanks Alisson, nothing happens when I added this to the -dv.js file. I typed in ggfhfg and it let me save it ok?
AppGini 22.13

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Restrict Field input

Post by angus » 2022-05-23 16:49

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 1457 times
AppGini 22.13

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Restrict Field input

Post by angus » 2022-05-24 09:43

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
AppGini 22.13

Alisson
Veteran Member
Posts: 81
Joined: 2017-02-25 20:32

Re: Restrict Field input

Post by Alisson » 2022-05-25 13:18

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

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Restrict Field input

Post by angus » 2022-06-10 13:45

perfect, thanks so much
AppGini 22.13

Post Reply