1. #1
    Sencha User kouphax's Avatar
    Join Date
    Mar 2007
    Location
    Belfast
    Posts
    58
    Vote Rating
    0
    kouphax is on a distinguished road

      0  

    Default Standard Submit with File Upload

    Standard Submit with File Upload


    There seem to be questions similar to mine but to be honest I could find one specifically related to my problem.

    What I would like to do if possible is submit a form using standardSubmit but the form I submit will be a fileUpload. Is this possible in Ext? The reason I ask is that the form appears to submit but there is no request made the page just seems to refresh.

    Is there away around this using Ext forms?

    Regards,

    James.

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,483
    Vote Rating
    35
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    It's the only way file uploads can function.

  3. #3
    Sencha User kouphax's Avatar
    Join Date
    Mar 2007
    Location
    Belfast
    Posts
    58
    Vote Rating
    0
    kouphax is on a distinguished road

      0  

    Default


    Oh OK.

    If is do an Ajax based upload (e.g. standardSubmit not used) - the thing works fine the only problem is I don;t want it to be ajax I actually want the form to submit and let my backend do some redirection. However when is set standardSubmit = true it simply refreshes the page and the request isn;t generated and therefore not processed by the backend.

    Am I doing something wrong? Example of my code would be...

    Code:
    wazhouseki.docbox.frm = new Ext.FormPanel({                            
        labelWidth: 120,
        url:'/wazHOUSEki/document/uploadDoc',
        frame:true,
        border:false,                    
        width: 500,   
        renderTo:"new-doc-form",
        bodyStyle:"padding:10px; background-color:#F4F0FF; border:1px solid #aa99cc;",
        defaultType: 'textfield',                            
        standardSubmit:true,    
        fileUpload:true,
        items: [
    
            {
                xtype:'fieldset',
                autoHeight:true,
                title:'Document Upload',
                items:[{
                    xtype:'textfield',
                    fieldLabel:'Document',
                    name:'file',
                    inputType:'file',
                    allowBlank:false
                }]
            },{
                xtype:'fieldset',
                autoHeight:true,
                title:'Document Metadata',
                items:[{
                    xtype:'textfield',
                    fieldLabel:'Title',
                    name:'title',
                    allowBlank:false,
                    width:300
                }]
            }
    
    
        ],
        buttons: [{
            text: 'Upload',
            handler: function(){                                    
                wazhouseki.docbox.frm.getForm().submit();           
            }
        },{
            text: 'Cancel',
            handler: function(){                                    
                wazhouseki.docbox.frm.getEl().hide({callback:function(){                                       
                    Ext.fly("new-doc-form").setHeight(0,true);                                        
                }});
            }
        }]
    });
    Seems like fairly standard code - perhaps I am simply not grasping the concept?

    JAmes

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,483
    Vote Rating
    35
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    file uploads don't use "Ajax" (XMLHttpRequest). They use standard browser submission

  5. #5

  6. #6
    Sencha User kouphax's Avatar
    Join Date
    Mar 2007
    Location
    Belfast
    Posts
    58
    Vote Rating
    0
    kouphax is on a distinguished road

      0  

    Default


    Apologies I didn't mean Ajax in the same sense I am aware of the IFRAME usage for file uploads but the problem is that no matter how it does it behind the scenes it's actually submitting the IFRAME rather than my page and therefore it isn't technically a standard submit of my ACTUAL page.

    I assume then that having standardSubmit and fileUpload both set to true is simply not going to work as the page will be submitted making the whole IFRAME upload thing will get lost? Is there no "out-of-the-box" way to submit my page rather than an IFRAME instead of having to write custom redirect code after the upload completes?

    Thanks for all your help so far.

    James.

  7. #7
    Sencha User kouphax's Avatar
    Join Date
    Mar 2007
    Location
    Belfast
    Posts
    58
    Vote Rating
    0
    kouphax is on a distinguished road

      0  

    Default


    Actually I think i sorted it now... I had to override the submit actions of the form and panel like it says in the API

    Code:
            onSubmit: Ext.emptyFn,
            submit: function() {
                this.getForm().getEl().dom.submit();
            }
    Also I noticed the generated FORM element didn;t have a corresponding action so I had to manipulate that as well

    this.getForm().getEl().dom.action = '<g:createLink controller="document" action="uploadDocument" />'

    This appears to have worked well.

    Thanks again for your help.

    James.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar