ExtJS获取隐藏表单字段的值

时间:2013-07-09 01:31:40

标签: extjs

首先,感谢您的耐心,我是Ext的新手。我要做的就是在HTML页面上获取隐藏表单字段的值,并将其值存储在ext脚本中。这是我正在使用的: HTML PAGE:

<form name="myForm">
<input type="hidden" id="accountID" name="divAccountID" value="463">
</form>

Ext Page:

var myAccountID = Ext.ComponentQuery.query('panel[name=myForm] #accountID');

3 个答案:

答案 0 :(得分:3)

这是最合适的:

var hidden = Ext.getCmp('accountID');
var hiddenValue = hidden.getValue();

答案 1 :(得分:2)

    var win = Ext.widget('nameofviev');  

//The above line will find the view in which we want to find the hidden fields 

    win.down('hidden#row_id').setValue(index);

//The above line set the value of hidden field that's `id` is `row_id`.
//If we remove the `#row_id` it find first hidden field and set value of that

//或

var hidden = Ext.getCmp('accountID');
var hiddenValue = hidden.getValue();

答案 2 :(得分:1)

你可以得到这样的价值:

var v = Ext.get('accountID').dom.value;

选中此示例: Jsfiddle