开发者

Extjs form not submitting its values

开发者 https://www.devze.com 2023-04-08 20:32 出处:网络
I have this function that creates a form and the form not submitti its values, what is wrong? It submits empty ajax, If I change the third line to applyTo:document.body it works fine.

I have this function that creates a form and the form not submitti its values, what is wrong?

It submits empty ajax, If I change the third line to applyTo:document.body it works fine.

(the tab variable is a tab panel that the form needs to be on it)

function myFunction(tab) {
    var frm = new Ext.form.FormPanel({
        applyTo: tab.id,
        height: 250,
        id: 'frm',
        name: 'frm',
        layout: 'form',
        width: 开发者_如何学JAVA520,
        url: 'operation/DataManipulator/',
        method: "post",
        labelWidth: 200,
        items: [{
            xtype: 'textfield',
            name: 'users',
            id: "users",
            fieldLabel: 'How many users to create?'
        }],

        buttons: [{
            text: 'Submit',
            handler: function (btn, evt) {
                frm.getForm().submit();
            }
        }]
    });


Try setting "scope: this" after "text:'Submit'" or try inside your handler function:

function(btn, evt) {
    Ext.getCmp('frm').getForm().submit();
}


Your method config should be method : 'POST'. The POST is case sensitive.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号