Manual:Forms:BasicForm:standardSubmit (Legacy)

This version of our Learning Center is unmaintained.
This article may be out-of-date or contain incorrect information.
Please visit the new Sencha Learning Center for up-to-date material.

Go to the new Sencha Learning Center

From Sencha - Learn

Jump to: navigation, search

Ext Manual > Forms > BasicForm >

The standardSubmit property is a boolean (defaults to false) that causes a BasicForm to execute a standard browser submit action using the generated DOM object. When this option is used, the url and baseParams properties are ignored.

Examples

This example will send the form using a standard browser submit, to the url specified in the config, and parse the baseParams into hidden fields before sending.

Ext.onReady(function(){
    var form = new Ext.form.FormPanel({
        renderTo: document.body,
        labelAlign: "side",
        frame: true,
        autoHeight: true,
        waitMsgTarget: true,
        standardSubmit: true,
        baseParams: {
            id: 1
        },
        url: "myProcess.php",
        title: "My Form",
        items: [{
            title: "Name Fields",
            xtype: "fieldset",
            autoHeight: true,
            defaults: {
                hideLabel: true,
                labelSeparator: ""
            },
            items: {
                xtype: "textfield",
                name: "userName"
            }
        }],
        buttons: [{
            text: "Save",
            handler: function(){
                var basic = form.getForm();
                if (basic.isValid()) {
                    if (form.url) 
                        basic.getEl().dom.action = form.url;
                    if (form.baseParams) {
                        for (i in form.baseParams) {
                            form.add({
                                xtype: "hidden",
                                name: i,
                                value: form.baseParams[i]
                            })
                        }
                        form.doLayout();
                    }
                    basic.submit();
                }
            }
        }]
    })
});


Links

This page was last modified on 16 February 2010, at 08:31. This page has been accessed 22,613 times.