1. #1
    Ext JS Premium Member
    Join Date
    Aug 2010
    Posts
    17
    Answers
    1
    Vote Rating
    0
    bsmithinghamisd is on a distinguished road

      0  

    Default Unanswered: Multi Part Form Upload / Ajax

    Unanswered: Multi Part Form Upload / Ajax


    I have a multipart form that uploads via Ajax, the upload seems to work fine, however when the callback comes to redirect the page, it doesn't redirect, it's just spinning. I see other people have similar issues, but no concrete answer. Hopefully, someone might be able to help.

    Thanks in advance.

    Code:
    <script type="text/javascript">
    
    
    
    
    
    
    Ext.require([
        'Ext.form.*',
        'Ext.data.*'
    ]);
    
    
    Ext.onReady(function(){
        
        //Models
        Ext.define('BidDoc', {
            extend: 'Ext.data.Model',
            fields: [
                'biddocID',
                'bidID',
                'biddocTitle',
                'biddocDescription',
                'biddocOrder',
                'biddocPostedDate',
                'biddocPostedDate_DATE',
                'biddocPostedDate_TIME',
                'biddocDueDate_DATE',
                'biddocDueDate_TIME',
                'biddocSubmitHardCopyFlag',
                'biddocSubmitUploadFlag',
                'biddocSubmitNoneFlag',
                'biddocOriginalFileName',
                'biddocNotes',
                'bidDocType_catalogitemID',
                'biddocSealedFlag'
            ]
        });
        Ext.define('example.fielderror', {
            extend: 'Ext.data.Model',
            fields: ['id', 'msg']
        });
        Ext.define('Bid', {
            extend: 'Ext.data.Model',
            fields: [
                'bidID',
                'bidTitle',
                'bidDescription',
    
    
                'bidProfileDeadlineDate_DATE',
                'bidProfileDeadlineDate_TIME',
    
    
                'bidOpeningDate_DATE',
                'bidOpeningDate_TIME',
    
    
                'bidQuestionDeadlineDate_DATE',
                'bidQuestionDeadlineDate_TIME',
    
    
                'bidIssueDate_DATE',
                'bidIssueDate_TIME',
    
    
                'bidEstAwardRecommendationDate_DATE',
                'bidEstAwardRecommendationDate_TIME',
    
    
                'bidEstContractStartDate_DATE',
                'bidEstContractStartDate_TIME',
    
    
                'bidResponseFormsDeadlineDate_DATE',
                'bidResponseFormsDeadlineDate_TIME',
    
    
                'bidFinalResponseFormsPostedDate_DATE',
                'bidFinalResponseFormsPostedDate_TIME',
    
    
                'bidEstContractEndDate_DATE',
                'bidEstContractEndDate_TIME'            
            ]
        });
        Ext.define('CatalogItem', {
            extend: 'Ext.data.Model',
            fields: [
                'catalogitemID', 
                'catalogID',
                'catalogitemValue',
            ]
        }); 
    
    
        var biddocfiletype_catalogitemstore = Ext.create('Ext.data.Store', {
            model: 'CatalogItem',
            autoLoad: false,
            remoteSort: true,
            proxy: {
                type: 'ajax',
                simpleSortMode: true,
                url: '/catalogitem/comboboxxml/catalogID/200',
                    reader: {
                        type: 'xml',
                        totalProperty: 'TotalResults',
                        record: 'CatalogItem'
                    }            
            }
        });
        var bidstore = Ext.create('Ext.data.Store', {
            model: 'Bid',
            autoLoad: false,
            remoteSort: true,
            proxy: {
                type: 'ajax',
                simpleSortMode: true,
                url: '/bid/comboboxxml/',
                    reader: {
                        type: 'xml',
                        totalProperty: 'TotalResults',
                        record: 'Bid'
                    }            
            }
        }); 
        
        //Form
        var formPanel = Ext.create('Ext.form.Panel', {
            renderTo: 'form',
            url:'/biddoc/dosavereupload',
            standardSubmit: false,
            width: 1000,
            bodyPadding: 0,
            border: 0,
            waitMsgTarget: true,
    
    
            fieldDefaults: {
                labelAlign: 'right',
                labelWidth: 250,
                msgTarget: 'under'
            },
    
    
            // configure how to read the XML data
            reader : Ext.create('Ext.data.reader.Xml', {
                model: 'BidDoc',
                record : 'BidDoc',
                successProperty: '@success'
            }),
    
    
            // configure how to read the XML errors
            errorReader: Ext.create('Ext.data.reader.Xml', {
                model: 'example.fielderror',
                record : 'field',   
                successProperty: '@success'
            }),
            items: [{
                xtype: 'fieldset',
                title: 'ReUpload - Bid Doc',
                items: [{
                            fieldLabel: 'ID',
                            name: 'biddocID',
                            itemId: 'biddocID',
                            xtype: 'textfield',
                            readOnly: true,
                            emptyText: 'ID'
                        },                
                        {
                            fieldLabel: 'File',
                            xtype: 'filefield',
                            name: 'fileupload',
                            width: 750,
                            allowBlank: false 
                        }    
                ]
    
    
            }],
    
    
            buttons: [{
                text: 'Save',
                formBind: true,
                handler: function(){
                    this.up('form').getForm().submit({
                        url:'/biddoc/dosavereupload/',
                        submitEmptyText: false,                    
                        headers: {'Content-type':'multipart/form-data'},
                        isUpload:true,
                        waitMsg: 'Saving...',
                        success: function() {
                            window.location.href = '/biddoc/listbiddocs/';
                        }
                    });
                }
            }]
        });
        
       
        
        //load the data into the form
        bidstore.load();
        biddocfiletype_catalogitemstore.load();
        formPanel.getForm().load({url: '/biddoc/LoadSingleXML/', waitMsg:'Loading'});
    });
    
    
    </script>
    <br>
    <div id="form"></div>

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,047
    Answers
    3493
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What are you returning? Any errors thrown?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext JS Premium Member
    Join Date
    Aug 2010
    Posts
    17
    Answers
    1
    Vote Rating
    0
    bsmithinghamisd is on a distinguished road

      0  

    Default


    my php script replies back with. i set the header to xml too. so that's not the problem.


    <message success="true">

    <errors/>

    </message>

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,047
    Answers
    3493
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Try returning JSON

    Code:
    {"success": true}
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Ext JS Premium Member
    Join Date
    Aug 2010
    Posts
    17
    Answers
    1
    Vote Rating
    0
    bsmithinghamisd is on a distinguished road

      0  

    Default


    Ok that worked. But I don't get it, my project is xml based. I'd prefer to stay with xml

  6. #6
    Ext JS Premium Member
    Join Date
    Aug 2010
    Posts
    17
    Answers
    1
    Vote Rating
    0
    bsmithinghamisd is on a distinguished road

      0  

    Default


    So I'm just getting back to this problem. I understand this works with JSON, anyway in getting this to work again with XML?

Thread Participants: 1

Tags for this Thread