I am building a form using Livecycle ES 8.2 and have a multi-line field that restricts the maximum number of characters entered (200). The tricky part is that we would like to have a live countdown of the number of characters the user has left available to them - as they are typing. I have managed to get it working to display the number, but the user has to leave the field for the number to update. Any ideas on how to make the countdown live?
Here's my code:
//TextField1 is the multi-line field and TextField1 is the read only field displaying the countdown.
//TextField2's calculate using FormCalc
var charCount = Len(TextField1[*]);
var totalCount = 200;
xfa.event.change = totalCount - charCount;
Thanks, Siri
var charCount = Len(TextField1[*]);
var totalCount = 200;
xfa.event.change = totalCount - charCount;
FormCalc doesn't use the ; at the end of the code lines!
2. A shorter way to calculate the numbers of chars is
200 - Len(TextField1) //put this into the change event of the field that shows the available chars
3. But the reason, why it also does not work in realtime is...
change
This event fires when the content of the field is changed by the user. This event fires on every
keystroke as long as the field has keyboard focus. It also fires when the user pastes into the field,
makes a selection from a choice list or drop-down menu, checks or unchecks a checkbox, or
changes the setting of a set of radio buttons. [b]It is not fired by content changes that are made by
the XFA application, for example calculations, nor is it fired by a merge operation.[/b]
Maybe, that you can solve this with a counter script.
Thom Parker relesed some examples for this in the past.
But using a timer for calculating the users input live may cause the form becomes rapidly slow.
radzmar
• LoveCycle Blog
Documents you need:
• LiveCycle Designer ES2 Docs