Copy link to clipboard
Copied
How can I limit entry in an acrobat fill-in form text field to only "X" or "N/A"?
Copy link to clipboard
Copied
You can use the Custom Keystroke or Validation actions.
Copy link to clipboard
Copied
Or use a drop-down field instead of a text field...
Copy link to clipboard
Copied
There are sixteen fields where we only want to allow an X or N/A. The drop down box and list box do not look good on the form. We want a text field that only allows one of the two entries.
Copy link to clipboard
Copied
Then I would write a document JavaScript level function for the custom keystroke or validation and call that function or functions in the custom keystroke or validation as needed.
I would use the following Custom KeyStroke script to convert each key entered to upper case:
if(!event.willCommit)
{
event.change = event.change.toUpperCase();
}
I would create a document level function that verifies a string is either an empty string, an "X", or "N/A". It returns logical true value if either of those conditions is met. This returned value can be used to set the return code for a validation script.
function XNA(cString)
{
var RC = true;
cString = cString.toUpperCase();
if(cString != "X" && cString != "N/A" && cString != "")
{
app.alert("Enter 'X' or 'N/A'", 1, 0);
RC = false;
}
return RC;
} // end function XNA which tests a String for being X, N/A or a null string;
I can then have a validation script like:
event.rc = XNA(event.value);
Copy link to clipboard
Copied
That worked great gkaiseril! Thanks so much.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now