This topic is locked

Character Counting

6/21/2014 3:57:01 PM
PHPRunner General questions
S
stec5345 author

Can anyone help with a problem I am facing? I need to be able to count characters in a large text field and then take that value and update a character count field. Is this even possible?

C
cristi 6/22/2014

If you have two fields: one your textArea named 'Text' and the other being the counter display named 'count' you can add in javascript Onload event in the add and edit pages the following code:



var count=Runner.getControl(pageid, 'count');
var text=Runner.getControl(pageid, 'Text');
function func() {

var fieldlength =text.getValue().length;

count.setValue(fieldlength);
};
text.on('keyup',func);

text.on('keydown',func);


The 'count' field should be read only of course...