nav
nav

Reputation: 319

decode textarea box value in extjs form

I have to decode my textbox value. I am using the code below

{
   xtype: 'textareafield',
   id: 'Reason',
   itemId: 'Reason',
   width: 100,
   name: 'Reason',
   fieldLabel: 'Reason / Comments ',
   displayField: 'Reason',
   allowBlank: false,
   anchor: '100%',
   listeners:{
      afterrender:function(value) {
          //alert(value);
          var reason = Ext.getCmp('Reason').getValue();
          //alert(reason);
          if(reason!='') {
              var reas = Ext.decode(reason);
              Ext.getCmp('Reason').setValue(reas);
          }
      }
   }
}

If I uncomment alert(value) here, it returns value in
alert(reason) and decodes my textbox value but if I
comment alert(value), it returns empty in alert(reason),
so doesn't decode my textbox value

Upvotes: 0

Views: 384

Answers (1)

sra
sra

Reputation: 23973

Because the afterrender event returns as first param a reference. It will work if you type: alert(value.getValue())

But you should really take a look at the API A textarea has no displayField at all

Upvotes: 1

Related Questions