1. #1
    Ext User
    Join Date
    Aug 2008
    Location
    Bordeaux
    Posts
    11
    Vote Rating
    0
    bisounux is on a distinguished road

      0  

    Default Error on submitting form (Syntax error () line 7389)

    Error on submitting form (Syntax error () line 7389)


    Hi everyone,

    I've a problem when I submit my form. Firebug rise a "Syntax error => ()" on ext-all-debug.js (line 7389).
    Here the FormPanel :
    Code:
                    this.formPanelAdd =  new Ext.FormPanel({
                        border:true
                        ,frame:true
                        ,autoHeight:true
                        ,fileUpload:true
                        ,id:'formAddParse'
                        ,labelWidth:100
                        ,margins :'10 10 10 10'
                        ,buttonAlign :'right'
                        ,bodyStyle :'padding-top:10px'
                        ,items:[{
                            border:false
                            ,layout:'column'
                            ,anchor:'100%'
                            ,monitorValid:true
                            ,autoHeight:true
                            ,defaults:{
                                columnWidth:1
                                ,autoHeight:true
                                ,border:false
                                ,layout:'form'
                                ,hideLabel:true
                            },
                            items: [{
                                anchor:'-25',
                                items:[{
                                    xtype:'fileuploadfield',
                                    fieldLabel: 'File',
                                    name:'filepath',
                                    allowBlank:false,
                                    tabIndex:1,
                                    autoWidth:true,
                                    id:'formAddParseFilePath'
                                },{
                                    xtype:'textarea',
                                    fieldLabel:'Comment',
                                    name:'filecomment',
                                    tabIndex:2,
                                    width:370,
                                    id:'formAddParseFileComment'
                                },{
                                    xtype:'combo',
                                    name:'filetype',
                                    fieldLabel:'Type',
                                    mode:'local',
                                    store:this.storeTypeFile,
                                    valueField:'typeName',
                                    displayField:'typeName',
                                    forceSelection :true,
                                    allowBlank :false,
                                    lazyRender :true,
                                    editable :false,
                                    triggerAction :'all',
                                    hiddenId:'idType',
                                    tabIndex:3,
                                    width:370,
                                    id:'formAddParseFileType'
                                },{
                                    xtype:'textfield',
                                    fieldLabel:'Template',
                                    name:'filetemplate',
                                    allowBlank:false,
                                    tabIndex:4,
                                    width:370,
                                    id:'formAddParseFileTemplate'
                                }]
                            }]}],
                        buttons:[{
                            text:'Upload and save',
                            iconCls:'icon-ok',
                            scope:this,
                            handler:this.onUploadAndSave,
                            tabIndex:5
                        },{
                            text:'Cancel',
                            iconCls:'icon-cancel'
                            ,tabIndex:6
                            ,scope:this
                            ,handler:function(el, ev){
                                Ext.getCmp('uploadParsefileWindow').close();
                            }
                        }]
                        ,keys:[{
                             key:[10,13] // enter
                            ,scope:this
                            ,stopEvent:true
                            ,fn:this.onUploadAndSave
                        }]
                        
                    });
    Here the handler for the upload button :
    Code:
    onUploadAndSave:function(){
            cc("upload and save clicked");
            var form = Ext.getCmp('formAddParse').getForm();
            if(form.isValid()){
                var parseFile=  {
                        name:Ext.getCmp("formAddParseFilePath").getValue(),
                        template:Ext.getCmp("formAddParseFileTemplate").getValue(),
                        comment:Ext.getCmp("formAddParseFileComment").getValue(),
                        type:Ext.getCmp("formAddParseFileType").getValue(),
                        affiliate : {id:this.idAffiliate}
                }
                DwrParseFile.add(parseFile, {
                    callback:this.uploadFile,
                    scope:this
                });
            }
        },
    Here the callback for my dwr function, where the submit is done :
    Code:
        uploadFile:function(res){
            this.fireEvent('callbackAdd', res);
            if(res.resultStatut == 'info'){
                var form = Ext.getCmp('formAddParse').getForm();
                cc(form); //console.debug : the form is ok;
                form.submit({//When I comment this, it works...
                    url:'uploadfile.jsp?path=' + res.obj.relativeFolderPath,
                    waitMsg:'Uploading file...',
                    success:function(fp,o){
                        ShowRes('File upload');
                    }
                    failure:function(fp,o){
                        cc("failed");
                        cc(fp);
                        cc(o);
                    }
                });
                Ext.getCmp("uploadParsefileWindow").close();
            }
        }
    I really don't understand why there is this problem. It might be a problem with a JSON object. When I comment the submit function, everything works well.
    Thank to everyone,
    Bisounux.

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    77
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    is your service returning {success:true} at minimum??

  3. #3
    Ext User
    Join Date
    Aug 2008
    Location
    Bordeaux
    Posts
    11
    Vote Rating
    0
    bisounux is on a distinguished road

      0  

    Default


    Which service are you talking about ? the jsp ?
    It doesn't POST at all, I can't see any POST request in firebug... So it can return nothing.
    Many thanks,
    Bisounux.

Thread Participants: 1