我有一个生成的表单面板脚本动态生成字段:EXTJS - 位于FormPanel
var form = new Ext.FormPanel({
id: 'form-exploit-zombie-' + zombie_ip,
formId: 'form-exploit-zombie-' + zombie_ip,
border: false,
labelWidth: 75,
formBind: true,
defaultType: 'textfield',
url: '/ui/modules/exploit/new',
autoHeight: true,
buttons: [{
text: 'Execute exploit',
handler: function() {
var form = Ext.getCmp('form-exploit-zombie-' + zombie_ip);
form.getForm().submit({
waitMsg: 'Running exploit ...',
success: function() {
Ext.beef.msg('Yeh!', 'Exploit sent to the zombie.')
},
failure: function() {
Ext.beef.msg('Ehhh!', 'An error occured while trying to send the exploit.')
}
});
}
}]
});
相同的脚本,然后检索从我的服务器json文件,它定义了多少输入字段的形式应包含。该脚本然后将这些字段的形式:
Ext.each(inputs, function(input) {
var input_name;
var input_type = 'TextField';
var input_definition = new Array();
if(typeof input == 'string') {
input_name = input;
var field = new Ext.form.TextField({
id: 'form-zombie-'+zombie_ip+'-field-'+input_name,
fieldLabel: input_name,
name: 'txt_'+input_name,
width: 175,
allowBlank:false
});
form.add(field);
}
else if(typeof input == 'object') {
//input_name = array_key(input);
for(definition in input) {
if(typeof definition == 'string') {
}
}
} else {
return;
}
});
最后,形式添加到相应的面板在我的界面:
panel.add(form);
panel.doLayout();
我的问题是:当我提交的表单点击按钮,发送到我的服务器的http请求不包含添加到表单的字段。换句话说,我不会将这些字段发布到服务器上。
任何人都知道我为什么以及如何解决这个问题?
我爱你。谢谢。 – Benjamin 2010-05-21 09:19:16
@Benjamin:没问题。 – 2010-05-21 10:04:35