Let me show my example, I've a form, there I have couple fields I need to show length of it (because there is some validation of length for this field).
So when user input new char in Title field, Character count should increase to 1. Know how to do that? I believe many of you know, but anywhere I would like to share this approach.
There are actually 2 fields: 1 for input and another one is just below the Title of field (computed type).
What we need to do - use some simple JavaScript lines..
step 1.
go to JS Header even in form/subform and put there couple lines of JS (select Run: Client and JavaScript)
var f = document.forms[0];
var stopDynamicalCounter = 0;
function updateCharCounter(delay) {
if(stopDynamicalCounter == 0) return;
f.AlternateTitle_length.value = f.AlternateTitle.value.length;
setTimeout( 'updateCharCounter( ' + delay + ' )', delay);
}
step 2.
select input-field, and go to onFocus event, select Run: Client and JavaScript and put there 2 lines
stopDynamicalCounter = 1;
updateCharCounter(100)
step 3.
select input-field, and go to onBlur event, select Run: Client and JavaScript and put there 1 line
stopDynamicalCounter = 0;
That's all.