Count characters

I have a open text field that I want the user to know how many characters they have type and the remaining characters.

For example. The field is set to 3000 characters. I want to character count field to show that they have typed 300 and the remaining is 2700.

Is there a script that I can use for that?

Ife


Yvette Pennant


5 Answers


George Kaiser   

Thanks George for responding. I need more explanation as to how I would set this up in my form. I am not a javascript person at all. Can you tell me what to put in a field and what that field should be named in order for this to work?


Yvette Pennant   

You can place a script in the Custom Keystroke Script option in the field that will receive the text. Supposing your count field is set to be multiline and is named as counter you can use a script like this in it:

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;
}

enter image description here


Almir R V Santos   

Did you read the linked PDF?

You should save the linked PDF to your local system and then open it up with Acrobat and edit the form. You will then be able to see the field names used by D.P. Story. You will also need to add the special function to merge the previously entered data and the current keystroke. There are tutorials that descrbe how to do this.

Unlike the custom calculation solution, this solution dynamically updated the character countdown, or the countdown is updated as characters are entered into the field.


George Kaiser   

Again, thanks. Unfortunately, the way the form is set up I cannot change the text fields in adobe acrobat.


Yvette Pennant   


Please specify a reason: