PDA

View Full Version : TextArea text Counter



chetan.nellekeri
23 Aug 2013, 10:09 PM
Hi, I want to create a text area which should count the text entered and display same in right side of textarea. Is there any such option in Ext JS or we manually code it????..
45518

scottmartin
24 Aug 2013, 11:52 AM
You can use the following:



Ext.onReady(function() {

var panel = Ext.create('Ext.form.FormPanel', {
title: 'Sample TextArea',
width: 400,
bodyPadding: 10,
renderTo: Ext.getBody(),
items: [{
xtype: 'textareafield',
grow: true,
name: 'message',
value: 'This is a test and only a test',
fieldLabel: 'Message',
anchor: '100%'
}]
});


var ta = panel.down('textareafield');

var charCount = ta.getValue().length;
console.log(charCount);
});

chetan.nellekeri
24 Aug 2013, 10:32 PM
Thanks Scott..
Actually I dont wont to display count in console.. I want to display just below the textArea as show in the screenshot..