Copy link to clipboard
Copied
Hello folks,
To start, rest assured I am not a student looking for answers on homework. Rather I am a graphic designer who stepped out of his box a bit too far and need help. I am wanting to have a textbox (Text1) for entering info and a separate textbox (Text2) display only the numbers of characters used [without spaces]. I don't even need the msg part either, just a number that is counting as the customer types. We are charging by the actual character for this form and not the spaces. Below is the only code I have found to function in my document, however it is beyond me on how to adjust it to my needs. Please help and thank you!
THIS ONE WORKS:
(Drop into ‘Custom Keystroke Script’)
Javascript below is for a character cnt w/spaces and a message of remainder.
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;
}
1 Correct answer
Enter this code as the custom Keystroke event of the text field:
this.getField("counter").value = AFMergeChange(event).replace(/\s/g, "").length;
It's possible that when you press OK after entering it it will disappear and the selection will revert to None, but it's actually there, so just click Close, save the file, and it should work.
Copy link to clipboard
Copied
Enter this code as the custom Keystroke event of the text field:
this.getField("counter").value = AFMergeChange(event).replace(/\s/g, "").length;
It's possible that when you press OK after entering it it will disappear and the selection will revert to None, but it's actually there, so just click Close, save the file, and it should work.
Copy link to clipboard
Copied
Very awesome! Thank you for the quick response!!!!

