【问题标题】:ExtJS get value of hidden form fieldExtJS 获取隐藏表单域的值
【发布时间】:2013-07-09 01:31:40
【问题描述】:

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

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

外部页面:

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

【问题讨论】:

    标签: extjs


    【解决方案1】:

    这个最合适:

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

    【讨论】:

      【解决方案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();
      

      【讨论】:

        【解决方案3】:

        你可以得到这样的值:

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

        检查这个例子:Jsfiddle

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-11-30
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-11-01
          • 2012-04-19
          相关资源
          最近更新 更多