如何在ExtJS中提交表单?

时间:2013-02-08 15:56:42

标签: extjs extjs4 extjs4.1

我有这段代码,但无论出于何种原因,它都没有提交表格。 submit()功能无效。为什么呢?

function kullaniciPenceresi()
{
    Ext.create('Ext.window.Window', {
    id: 'kullaniciEditWin',
    iconCls: 'icon-user--pencil',
    animateTarget: Ext.getCmp("kullaniciDuzenleButonu"),
    title: 'Kullanıcı Düzenle',
    modal: true,
    items: {  // Let's put an empty grid in just to illustrate fit layout

        bodyPadding: 5,
        width: 350,

        // The form will submit an AJAX request to this URL when submitted
        url: 'php/post_data.php?yol=kullanici_formu',

        // Fields will be arranged vertically, stretched to full width
        layout: 'anchor',
        defaults: {
            anchor: '100%'
        },

        // The fields
        defaultType: 'textfield',
        xtype: "form",
        id: "kullaniciformu",
        items: [

            {
                xtype:'fieldset',
                                    layout: 'anchor',
            defaults: {
                anchor: '100%'
            },
                title: 'Hesap Bilgileri',
                defaultType: 'textfield',
                items:[
                    {
                        fieldLabel: 'Şirket',
                        name: 'OrganizationName',
                        allowBlank: false
                    },

                    {
                        fieldLabel: 'Email',
                        name: 'Email',
                        vtype: "email",
                        allowBlank: false
                    },

                    {
                        fieldLabel: 'Şifre',
                        name: 'sifre',
                        vtype: "password",
                        disabled: true
                    },

                    {
                        fieldLabel: 'GrupName',
                        name: 'first',
                        allowBlank: false,
                        xtype: "combo",

                        displayField: 'name',
                        valueField: 'name',
                        store: store,
                        queryMode: 'local',
                        typeAhead: true  
                    },
                    {
                        xtype: 'buttongroup',
                        items: [
                            {text: 'Yetkilendirme: '},
                            {xtype: 'button', text: 'Bina', iconCls: 'building',

            handler: function() {


                Ext.create('Ext.window.Window', {
                    title: 'Hello',
                    height: 200,
                    modal: true,
                    width: 400,
                    layout: 'fit',
                    items: {  // Let's put an empty grid in just to illustrate fit layout
                        xtype: 'grid',
                        border: false,
                        columns: [{header: 'World'}],                 // One header just for show. There's no data,
                        store: Ext.create('Ext.data.ArrayStore', {}) // A dummy empty data store
                    }
                }).show();



            }
                            },
                            {xtype: 'button', text: 'Daire', iconCls: 'building'},
                            {xtype: 'button', text: 'Cihaz', iconCls: 'counter'}
                        ]
                    },


                ]
        },

        {
            xtype:'fieldset',
            title: 'Kişisel Bilgiler',
            defaultType: 'textfield',
            layout: 'anchor',
            defaults: {
                anchor: '100%'
            },
            items:[


        {
            fieldLabel: 'Ad',
            name: 'FullName',
            allowBlank: false
        },


        {
            fieldLabel: 'Telefon',
            name: 'phone',
            allowBlank: true
        }]
        }]


       },

        buttons: [{
            text: 'Save',
            handler: function() {
                Ext.getCmp("kullaniciformu").submit(); // <----------------
                Ext.getCmp("absolute-panel").load;
                Ext.getCmp("kullaniciEditWin").close();
            }
        },{
            text: 'Cancel',
            handler: function() {
                Ext.getCmp("kullaniciEditWin").close();
            }
        }]
    }).show();
}

编辑:好的,我已经弄明白了。如果组字段为空,则不会提交。

1 个答案:

答案 0 :(得分:1)

必须填写所有字段,以便提交POST。