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

New Here ,
May 03, 2018

Copy link to clipboard

Copied

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!

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

63

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

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

New Here ,
May 03, 2018

Copy link to clipboard

Copied

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!

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

64

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 03, 2018 0
Most Valuable Participant ,
May 03, 2018

Copy link to clipboard

Copied

Why not use a drop-down field, instead?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 03, 2018 0
New Here ,
May 03, 2018

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 03, 2018 0
Most Valuable Participant ,
May 03, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 03, 2018 0
SandiRR LATEST
New Here ,
May 03, 2018

Copy link to clipboard

Copied

Perfect! Thank you!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 03, 2018 0