EXTjs想要获取输入框的值
问题描述:
点击按钮获取到前三个输入框的内容,添加到第四个输入框里面,请问按钮里面的事件应该怎么写?
答
控价添加id,然后Ext.getCmp('id').getValue()就行了,id参数替换为你控件的id
{
xtype: 'textfield',
name: 'PGID',id:'PGID',/////////==>Ext.getCmp('PGID').getValue()
fieldLabel: 'BaseURL',
allowBlank: false // requires a non-empty value
}
{
xtype: 'combobox',
name: 'name',id:'BaseURL',/////////==>Ext.getCmp('BaseURL').getValue()
fieldLabel: 'BaseURL',
allowBlank: false // requires a non-empty value
}
答
handler: function(btn){
var win = btn.up('window'),
form = win.down('form'),
baseURL = form.getForm().findField('NamePropertyValue').getValue(); ////NamePropertyValue用name属性就行,Extjs建议尽量少用Id,特别是tree
form.getForm().findField('compain...').setValue(baseURL);
}