Copy link to clipboard
Copied
I do not know javascript. I thought Adobe had a library of static code to add but, alas, I was mistaken. Issue - I have a form I designed from scratch. Trying to display for the user the following:
1. As they type in a field, display the number of characters remaining, and/or
2. Display an error message when trying to exceed the max number of characters for a field.
Doesn't seem this should be so difficult. In one of the multitude of threads I read, a user made a good point: if Adobe Pro is calculating the number of characters being entered in a character constrained field, why can't this be displayed? Duh, Adobe!
Copy link to clipboard
Copied
You can find answer how to count characters as you type here:
https://answers.acrobatusers.com/Count-characters-q113907.aspx
Copy link to clipboard
Copied
I am not clear if I'm adding this script correctly. I went to that thread and saw the following code. Am I just copying and pasting it in the custom keystroke script box? If I do, it's not working. Changed the number of characters of 3000 to 255. I have zero clue what I'm doing.
if (event.willCommit == false) {
var ec = event.change;
var nv = event.value + ec;
var nc = nv.length;
var msg = nc + " characters typed.\n";
msg += (3000 - nc) + " remaining.";
this.getField("counter").value = msg;
}
Copy link to clipboard
Copied
It will display remaining character in field "counter" do you have that field in your file? If not you should rename it to the field name where you want to show message.