Results 1 to 4 of 4

Thread: How can i submit a form into a windows

  1. #1

    Default How can i submit a form into a windows

    Hello,

    I created an Extjs windows, and i putted a form into it, but i'm not able to submit my form
    I understood how i can do it with a simple form (in fact with form into an object : var my_form = new Ext.Form ...).
    But with my own code, i can't. Can you help me ?
    Thanks.

    This is my own code:
    Code:
            <script language="JavaScript">
            Ext.BLANK_IMAGE_URL = 'extjs/resources/images/default/s.gif';
            Ext.onReady(function(){
            Ext.QuickTips.init();
            var win = new Ext.Window({
                //url: 'movie-form-submit.php',
                title: 'Fiche client',
                renderTo:Ext.getBody(),
                iconCls:'icon-bulb',
                width:650,
                height:415,
                border:false,
                layout:'fit',
                items:[{
                    // form as the only item in window
                    xtype:'form',
                    url: 'movie-form-submit.php',
                    standardSubmit: true,
                    //id:'fiche',
                    //labelWidth:60,
                    frame:true,
                    items:[{
                        xtype: 'textfield',
                        fieldLabel: 'Civilit',
                        name: 'civilite'
                    },{
                        xtype: 'textfield',
                        fieldLabel: 'Nom',
                        name: 'nom',
                        allowBlank: false
                    },{
                        xtype: 'textfield',
                        fieldLabel: 'Catalogue',
                        name: 'catalogue'
                    },{
                        // column layout with 2 columns
                        layout:'column',
    
                        // defaults for columns
                        defaults:{
                        columnWidth:0.5,
                        layout:'form',
                        border:false,
                        xtype:'panel',
                        bodyStyle:'padding:0 18px 0 0'
                        },
                        items:[{
                            // left column
                            // defaults for fields
                            defaults:{anchor:'100%'},
                            items:[{
                                xtype: 'label',
                                fieldLabel: 'Facturation',
                                name: 'released'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Adresse',
                                name: 'fact_adresse',
                                allowBlank: false,
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Adresse (suite)',
                                name: 'fact_adresse2'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Code Postal',
                                name: 'fact_cp',
                                allowBlank: false,
                                vtype: 'alphanum'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Ville',
                                name: 'fact_ville',
                                allowBlank: false
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Interlocuteur',
                                name: 'fact_interlocuteur',
                                allowBlank: false
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Tlphone',
                                name: 'fact_telephone',
                                allowBlank: false
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Tlcopie',
                                name: 'fact_fax'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Portable',
                                name: 'fact_portable'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Email',
                                name: 'fact_email',
                                vtype: 'email'
                            }]
                        },{
                            // right column
                            // defaults for fields
                            defaults:{anchor:'100%'},
                            items:[{
                                xtype: 'label',
                                fieldLabel: 'Livraison',
                                name: 'released'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Adresse',
                                name: 'livr_adresse'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Adresse (suite)',
                                name: 'livr_adresse2'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Code Postal',
                                name: 'livr_cp',
                                vtype: 'alphanum'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Ville',
                                name: 'livr_ville'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Interlocuteur',
                                name: 'livr_interlocuteur'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Tlphone',
                                name: 'livr_telephone'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Tlcopie',
                                name: 'livr_fax'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Portable',
                                name: 'livr_portable'
                            },{
                                xtype: 'textfield',
                                fieldLabel: 'Email',
                                name: 'livr_email',
                                vtype: 'email'
                            }],
                            buttons: [{
                                text: 'Enregister',
                                handler: function(){
                                //Ext.Msg.alert('Hello', 'Submit');
                                this.getForm().submit({
                                    success: function(f, a){
                                    Ext.Msg.alert('Enregistrement', 'Fiche sauvegarde');
                                    },
                                    failure: function(f, a){
                                    Ext.Msg.alert('Enregistrement', "Echec de l'enregistrement : " + a.result.erromsg);
                                    }
                                })
                                }
                            }]
                        }]
                    }]
                }]
            });
            win.show();
            });
        </script>

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    "not able"

    What's the problem? WHat happens when you step into the "enregister" handler function? Does Firebug show errorss? Does Firebug show any data being sent to the server? Does it show data sent back?

    Basically, what have you done to help yourself?

  3. #3
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    What are you expecting that 'this' is in the button click handler?

    Try:
    Code:
    win.getComponent(0).getForm().submit({...});
    or
    Code:
    this.ownerCt.ownerCt.getForm().submit({...});

  4. #4

    Default

    It's working fine now. Thanks for help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •