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.
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.
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.
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.