ComboBox valueField - Ext JS

本文讨论了在ExtJS中如何将隐藏输入字段的ID设置为与其名称相同的问题。这有助于通过ID直接访问隐藏字段的值,对于使用ExtJS表单进行开发的人员来说是一个实用的技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Hi,

I noticed that you are creating a hidden input and storing the valueField in that input. This works great if you will be submitting the form because you store the hiddenName. Is it possible to make the id of that hidden input the same as its name? This allows you to access the value by id which happens to be what I am doing.

I believe this should do the trick (located in Combo.js):

    onRender : function(ct){
        Ext.form.ComboBox.superclass.onRender.call(this, ct);
        if(this.hiddenName){
            this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName, id: this.hiddenName},
                    'before', true);
            this.hiddenField.value = this.value;
        }
      ...
I would love to see this added into the library.
Reply With Quote
  #2  
Old 03-08-2007, 07:03 PM
Default

Actually, that didn't work for me. But I'm sure there is a master mind among you that can achieve what I am after.
Reply With Quote
  #3  
Old 03-12-2007, 10:32 PM
Default

Any chance of getting the value into the id of the hidden field?
Reply With Quote
  #4  
Old 03-12-2007, 10:54 PM
Default

Sorry to not respond. I already added it in, it will be in the next rev.
Reply With Quote
  #5  
Old 03-13-2007, 12:14 PM
Default

Thank you, this is a much appreciated addition.
Reply With Quote
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值