1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    29
    Vote Rating
    0
    dadofgage is on a distinguished road

      0  

    Default question about form submission

    question about form submission


    I am confused a bit on trying to make my form submit.

    Here is the code I am using for the form panel and the submit button.

    I am trying to direct the form to a perl script to do the database work but after I fill out the form, nothing happens.

    I took the code for the submit button directly from the docs, I'm not needing to do anything fancy, just submit the form.

    Anyone have a suggestion?

    Code:
    var simpleForm = new Ext.FormPanel ({
            labelWidth: 175,
            url:'storage_new_project_action.pl',
            method: 'POST',
            frame:true,
            title: 'Ada a New Project',
            bodyStyle:'padding:5px 5px 0',
            width: 850,
            defaultType: 'textfield',
     
            items: [
                {
                    fieldLabel: 'Project Name',
                    name: 'ProjectName',
                    allowBlank:false,
                    anchor:'100%'
                },
                {
                    fieldLabel: 'Project Manager',
                    name: 'ProjectManager',
                    allowBlank:false,
                    anchor:'100%'
                },
                {
                    fieldLabel: 'IT Senior Manager',
                    name: 'ITSeniorManager',
                    allowBlank:false,
                    anchor:'100%'
                },
                {
                    fieldLabel: 'Primary Release Manager',
                    name: 'PrimaryReleaseManager',
                    allowBlank:false,
                    anchor:'100%'
                },
                {
                    fieldLabel: 'Project Description',
                    name: 'Description',
                    xtype: 'textarea',
                    anchor:'100%'
                },
                {
                    xtype: 'fieldset',
                    title: 'Projected Growth',
                    autoHeight: true,
                    autoWidth: true,
                    collapsible: false,
                    collapsed: false,
                    items: [projections_grid]
                }
            ],                
     
            buttons: [{
                text: 'Submit',
                formBind: true, //only enabled once the form is valid
                handler: function() {
                var form = this.up('simpleForm').getForm();
                if (form.isValid()) {
                    form.submit({
                        success: function(form, action) {
                           Ext.Msg.alert('Success', action.result.msg);
                        },
                        failure: function(form, action) {
                            Ext.Msg.alert('Failed', action.result.msg);
                        }
                    });
                }
                }
            },{
                text: 'Cancel',
                handler: function () {
                    // when this button clicked, reset this form
                    simpleForm.getForm().reset();
                }
            }]
     
        });

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi!

    just put a debugger or set a break point and debug your code.

    Check what are you getting in the var form, i.e.
    Code:
    var form = this.up('simpleForm').getForm();
    and also check in the console whether your form is valid or not, because if your form is not valid, success or failure will not be there (according to your code)
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    29
    Vote Rating
    0
    dadofgage is on a distinguished road

      0  

    Default


    Quote Originally Posted by sword-it View Post
    Hi!

    just put a debugger or set a break point and debug your code.

    Check what are you getting in the var form, i.e.
    Code:
    var form = this.up('simpleForm').getForm();
    and also check in the console whether your form is valid or not, because if your form is not valid, success or failure will not be there (according to your code)
    thanks for the reply - I must have an error somewhere on my form since when I put a breakpoint at

    Code:
    var simpleForm = new Ext.FormPanel ({
    firebug is telling me that 'simpelForm' is undefined

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,927
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    You are not evaluating simpleForm correctly in your button handler:

    Code:
    handler: function(btn) {
    
        // grab the xtype of the parent for button, 
        // or var form = btn.up('form'), 
        // or var form = this.up('form'), 
        // or assign itemId to form and use var form = btn.up('#formItemId')
        var form = btn.up('form'); 
    
        // you have assign this to a var; 
        // so just use simpleForm: simpleForm.getForm();
        var form = this.up('simpleForm').getForm();  // will not work
    }
    Regards,
    Scott.

  5. #5
    Sencha User
    Join Date
    May 2012
    Posts
    29
    Vote Rating
    0
    dadofgage is on a distinguished road

      0  

    Default


    Thanks for the reply Scott, I was able to get it working.

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi