PDA

View Full Version : maxlength problem



olavevismaya
18 Sep 2010, 1:36 AM
hi..
i have one drop down and one textarea,according dropdown entry i have to set maxlength of text area.
if u have solution help me.....

troseberry
18 Sep 2010, 9:18 AM
Heres a quick dirty example.



Ext.onReady(function(){
Ext.QuickTips.init();
var store = new Ext.data.SimpleStore({
fields: ['data'],
data: ['1','2','3','4','5'],
autoLoad: false
});
var simple = new Ext.form.FormPanel({
id: 'simpleForm',
title: 'Simple Form',
labelWidth: 75,
frame: true,
bodyStyle: 'padding:5px 5px 0',
width: 350,
renderTo: Ext.getBody(),
items: [{
xtype: 'combo',
store: store,
fieldLabel: 'ComboBox',
displayField: 'data', // what the user sees in the popup
valueField: 'data', // what is passed to the 'change' event
typeAhead: true,
forceSelection: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
editable: true,
listeners: {
select: function(combo, record, index){
var textArea = simple.getComponent('TextArea');
textArea.clearInvalid();
textArea.maxLength = record.get('data');
textArea.isValid();
}
}
},
{
xtype: 'textarea',
itemId: 'TextArea'
}]
});
});