Creating an “X characers remaining” box for a text input

Home Forum General Creating an “X characers remaining” box for a text input

This topic contains 5 replies, has 0 voices, and was last updated by  pmeidinger 10 years, 11 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #587


    I want to display to the user the number of characters they have left to enter in a multiline text input. I created a separate text input field to show this number. In the multiline’s “Key is pressed behavior”, I added a Set Field command that sets the value of the other input field to (100 – Length(multiline input text)). However, the number is only updated when I tab out of the multiline field and back in, not while I’m typing. The same thing happens if I use the “Multiline Text Input changes field data” behavior.

    How can I get the number to update as I’m typing?


    You could set a timer on a 1 second loop. Start the timer when the input gains focus, and stop it when it looses focus. Every time the timer stops (completes a 1 second loop) run the counting behavior.



    Sure, I could do that, but why doesn’t the “Key is pressed” behavior executed every time a key is pressed? Why does it wait until I tab out and back in?


    The length (number of characters) in a text box will be empty until you tab (or click) out of that control. One solution to your problem is setting a numeric field with -1 every time a key is clicked in an input field. The numeric field would be pre-set with the number of characters available and then subtract for each one added. The obvious flaw in this solution is when the backspace key is used. Aside from this we have no way to dynamically count the number of characters in a field as that field is being filled.



    Thanks, Dennis. As a feature request, it would be great if the “Key is pressed” behavior fire every time a key is pressed. It would also be neat if the behavior could identify *which* key was pressed.


    To clarify, the key is pressed feature will fire a behavior every time a key is pressed in the subject object. It does work correctly. The reason that you are not able to have a dynamic count of characters is that “length” cannot be determined until the object looses focus. Length is not dynamic. I will ask the development team about adding a feature to determine which key was pressed.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.