Extjs - dynamic creation of fields in FormPanel

I have a script that generates a form panel:

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.')
                }
            });
        }
    }]
});

the same script retrieves the json file from my server, which determines how many input fields should contain. Then the script adds these fields to the form:

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;
    }
});

Finally, the form is added to the corresponding panel in my interface:

panel.add(form);
panel.doLayout();

The problem is this: when I submit the form by clicking the button, the HTTP request sent to my server does not contain the fields added to the form. In other words, I do not host these fields on the server.

Does anyone know why and how I can fix this?

+5
source share
2 answers

Your problem is here:

id: 'form-exploit-zombie-'+zombie_ip,
formId: 'form-exploit-zombie-'+zombie_ip,

, , , id id ( ) . , , .

formId: 'form-exploit-zombie-'+zombie_ip,

.

+9

HTTP- ?

PHP, , ? , "xyz",

$_POST[ 'txt_xyz' ]
0

All Articles