Skip to main content
SandiRR
Participant
May 3, 2018
Answered

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

  • May 3, 2018
  • 2 replies
  • 598 views

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 has been closed for replies.
Correct answer try67

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

2 replies

SandiRR
SandiRRAuthor
Participant
May 3, 2018

Perfect! Thank you!

try67
Community Expert
Community Expert
May 3, 2018

Why not use a drop-down field, instead?

SandiRR
SandiRRAuthor
Participant
May 3, 2018

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.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
May 3, 2018

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