Tagged: behavior multiline
- October 19, 2010 at 7:07 pm #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?October 19, 2010 at 11:45 pm #5467
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.October 19, 2010 at 11:47 pm #5468
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?November 2, 2010 at 6:09 pm #5475
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.November 2, 2010 at 6:19 pm #5476
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.November 2, 2010 at 6:24 pm #5477
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.
You must be logged in to reply to this topic.