we are using chronoforms v5 by recomendation of everyone and we are sure we'll solve this issue.
we have a multitab form inside of a conditional multipage(if condition true on page 1 goes to page 2)
our issue is that we don't know where execute js code ¿on load page 1 or in page 2? text-box is on page 2
Our js code to count Words on text-box is:
our code in label field of text box with id=resumen is
<label class="cf_label" style="width: 450px;">Quedan por escribir <span id='int_counter'>500</span> palabras</label>
we have a multitab form inside of a conditional multipage(if condition true on page 1 goes to page 2)
our issue is that we don't know where execute js code ¿on load page 1 or in page 2? text-box is on page 2
Our js code to count Words on text-box is:
window.addEvent('load', function() {
// execute the check after each keystroke
$('resumen').addEvent('keyup', function() {
// set the maximum number of words
int_max_words = 500; // get the current value of the input field
s = $('resumen').value;
s = s.replace(/(^\s*)|(\s*$)/gi,"");
s = s.replace(/[ ]{2,}/gi," ");
s = s.replace(/\n /,"\n");
// get current words count contando los espacios
int_current_length = s.split(' ').length;
// calculate remaining chars
int_remaining_words = int_max_words - int_current_length;
// show the remaining characters
// Change color if there are less than 5 chars remaining
if (int_remaining_words <=5) {
$('resumen').setStyle('background-color', '#F88');
$('resumen').value = $('resumen').value.substring(0,int_max_words-1);
if (int_remaining_words <=0) {
int_remaining_words=0;
}
}
else {
$('resumen').setStyle('background-color', 'white');
}
$('int_counter').innerHTML = int_remaining_words;
});
});
our code in label field of text box with id=resumen is
<label class="cf_label" style="width: 450px;">Quedan por escribir <span id='int_counter'>500</span> palabras</label>