15

In jsp, if there is a hidden variable, we do this in js:

document.getElementById('hiddenVarId').setValue = 'xxx';

What is the extjs equivalent of document.getElementById().setValue = 'xxx';

Victor
  • 16,609
  • 71
  • 229
  • 409

3 Answers3

21
Ext.get('hiddenVarId').set({value: 'xxx'});

This another possibility that leverages the ExtJS method set(). This way you can set multiple attributes on an Ext.Element at once if that's something you also require now or later.

http://dev.sencha.com/deploy/dev/docs/?class=Ext.Element

ChrisR
  • 14,370
  • 16
  • 70
  • 107
8
Ext.get('hiddenVarId').dom.value = 'xxx';

Ext.get returns an Ext.Element which has the actual DOM object in the dom property. You can then directly assign to the value property.

wombleton
  • 8,336
  • 1
  • 28
  • 30
3
Ext.getCmp('hiddenVarId').setValue('xxx');

Ext.get() vs Ext.getCmp()

KBIIX
  • 873
  • 9
  • 14