Copy link to clipboard
Copied
When creating digital forms in Acrobat, I see you can set a Maximum character limit easily when opening the Text Field Properties, then going to the Options Tab to do so. But there's nothing about setting a MINIMUM. I'm not familiar with JavaScript at all, and I saw a post from about 10 years ago talking about this, so I'm sure it's dated to say the least in fixing my issue.
Thanks in advance!
If you're OK with the value being validated when the user exits the field (not as they're typing), you can use this code as the custom Validation script for it:
var minAllowedChars = 5;
if (event.value.length>0 && event.value.length<minAllowedChars) {
app.alert("You must enter at least "+minAllowedChars+" characters.");
event.rc = false;
}
Copy link to clipboard
Copied
How would the user be able to fill in the field if there's a minimum limit to the number of characters in it?
Or do you only want to validate it after they leave the field? And should it allow the field to be empty?
Copy link to clipboard
Copied
If you're OK with the value being validated when the user exits the field (not as they're typing), you can use this code as the custom Validation script for it:
var minAllowedChars = 5;
if (event.value.length>0 && event.value.length<minAllowedChars) {
app.alert("You must enter at least "+minAllowedChars+" characters.");
event.rc = false;
}
Copy link to clipboard
Copied
PS. Nothing much changed in this regard in the last 10 years, maybe even 20. If you found a solution for this issue from 10 years ago it will very likely work now, too. The only thing that might have changed since then is how to arrive to the place where the code should go.
Copy link to clipboard
Copied
Perfect. Thank you!