Skip to main content
SandiRR
Participant
May 3, 2018 3:42 PM UTC
Answered

Script that requires the user to type in "Y" or "N".

I am working in Acrobat Pro X1. and am designing a fillable form that has a column that requires the user to put either a "Y" or "N" only. (This may be changed to "P" or "F" pass or fail). I made an Arbitrary Mask with "A" and this works except that any alpha can be typed into the column. I know that this should be simple but I'm just not finding it.

Do I need to run a validation?  and if I do, what would that look like?

I would appreciate any help.

Thanks!

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
May 3, 2018 5:03 PM UTC

OK, then you can use this code as the field's custom validation script:

if (event.value) event.rc = (event.value=="Y" || event.value=="N");

4 replies

SandiRR
SandiRRAuthor
Participant
May 3, 2018 5:09 PM UTC

Perfect! Thank you!

Translate
try67
Community Expert
Community Expert
May 3, 2018 4:53 PM UTC

Why not use a drop-down field, instead?

Translate
SandiRR
SandiRRAuthor
Participant
May 3, 2018 5:01 PM UTC

Normally that would work but there is only enough room for one character in the column. (Basically the drop-down is too big) Also, there are 28 lines in the column with text boxes on either side.

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
May 3, 2018 5:03 PM UTC

OK, then you can use this code as the field's custom validation script:

if (event.value) event.rc = (event.value=="Y" || event.value=="N");

Translate