Countdown Maximum Length Input

| 6 Comments

This problem was posed to me by Dale S. He wanted to create a
text field with a maximum character limit, but want to be able
to countdown to the user the number of characters still available
to enter into the field. This article contains my solution to this
problem.

I’ve posted an updated version of this PDF; the version of the PDF linked below now responds to Ctrl+Z, which was a concern of  one of the comments to this article.

Click to continue reading: pdfblog_26.pdf

 

 

6 Comments

  1. Thank you for sharing your approach to solving this problem. I’ve tried this before and was not able to come up with a solution that covers all cases, so I was excited to see another approach. Unfortunately, your solution suffers from the same problem that I was not able to overcome as well: As long as you just enter and delete, or paste into the form field, everything works just fine. The problem is that you cannot correctly deal with the Ctrl-Z Undo operation: Acrobat does not send a keystroke event for that operation, so the character count is wrong right after the user presses Ctrl-Z. Things will of course be corrected when new characters are types.

    Again, thanks for sharing.

  2. Karl, I’ve uploaded a new version of this PDF that responds to Ctrl+Z. Ctrl+Z would enter the deleted text as committed text. I’ve remove the conditional if (!event.willCommit), so the keystroke script is executed for committed and uncommitted data.

  3. Got the update Thanks!

    However, I am using Options; “Comb of” to limit my text / characters
    (an easy way to obtain a kerning effect).

    The current, updated script, I think, is using the “Limit of” option
    to set a maximum character limit.

    Options would be to script / Kern the text fields on
    a Document level or use the previous version (I do not have this script).

    Can this script reference the “Comb of” instead of “Limit of” ?

    I look forward to your thoughts..

    D-

Leave a Reply

Required fields are marked *.