Tengo un script que genera un panel de formato:Extjs - Dinámicamente generar campos en un 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.')
}
});
}
}]
});
mismos scripts que se recupera un archivo JSON de mi servidor que define el número de campos de entrada que la forma debe Contiene. La secuencia de comandos agrega esos campos al formulario:
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;
}
});
Finalmente, se añade la forma al panel apropiado en mi interfaz:
panel.add(form);
panel.doLayout();
El problema que tengo es: cuando envíe el formulario al hacer clic en el botón, la solicitud http enviada a mi servidor no contiene los campos agregados al formulario. En otras palabras, no estoy publicando esos campos en el servidor.
¿Alguien sabe por qué y cómo puedo solucionarlo?
te amo. Gracias. – Benjamin
@Benjamin: No hay problema. –