Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

Form Submit with additional parameters using Sencha (ExtJS)


To submit a form with additional parameters with the form fields, config the param field array like below:

profileForm.getForm().submit({
    clientValidation: true,
    url: 'account-processor.php',
    params: {
        task: 'saveProfile',
        sid: SERVICE_SID,
        acc_id: ACCOUNT_ID,
        service_id: SERVICE_SELECTED,
        new_username: NEW_USERNAME
    },
    success: function(form, action) {
       Ext.Msg.alert('Success', action.result.msg);
    },
    failure: function(form, action) {
        switch (action.failureType) {
            case Ext.form.Action.CLIENT_INVALID:
                Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values');
                break;
            case Ext.form.Action.CONNECT_FAILURE:
                Ext.Msg.alert('Failure', 'Ajax communication failed');
                break;
            case Ext.form.Action.SERVER_INVALID:
               Ext.Msg.alert('Failure', action.result.msg);
       }
    }
});
Advertisements

Comments are closed.

%d bloggers like this: