Results 1 to 5 of 5

Thread: form submit in internet explorer calls the failure callback function

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2014
    Posts
    9

    Default form submit in internet explorer calls the failure callback function

    A form submit is used to upload a file(a restful webservice is called).
    The file upload works fine in Chrome and the success callback function is invoked.

    Howver in Internet Explorer 11, the failure function is called. The below is the JSON object that is returned.

    {"message":"","success":true,"rowsInserted":1,"rowsDeleted":0,"rowsUpdated":0,"emailSent":0,"exception":null,"auditNumber":326}

    Moreover after the failure function is called in Internet Explorer the browser gives an option to download the json file.

    Below is the form.submit code.

    Code:
    form.submit({
                                url: AppConstants.baseUrl+'add-attached-file',
                                waitMsg: 'Uploading file...',
                                standardSubmit:false,
                                //contentType: "application/x-www-form-urlencoded;charset=utf-8",
                                //headers: {'Content-Type':'multipart/form-data; charset=UTF-8'},
                                success: function (form1, action, a, b, c) {
                                    //console.log('success uploading file');
                                    //msg('Success', 'Processed file "' + o.result.file + '" on the server');
                                    if(form.attachedFilesStore)
                                    {
                                        form.attachedFilesStore.reload(function(records, operation, success) {
                                            console.log('reload function:loaded attachment records');
                                            console.log(records);
                                        });
                                    }
                                    else {
                                        var auditNumber = Ext.decode(action.response.responseText).auditNumber;
                                        if(!form.auditNumber)
                                        {
                                            form.auditNumber = auditNumber;
                                            form.auditForm.getViewModel().set('auditMain.auditEntity.auditNumber',auditNumber);
                                        }
                                        var proxy = new Ext.data.proxy.Ajax({
                                            type: 'ajax',
                                            useDefaultXhrHeader: false,
                                            api: {
                                                read: AppConstants.baseUrl + 'get-attached-files?audit_number='+auditNumber
                                            },
                                            reader: {
                                                type: 'json',
                                            },
                                            writer: {
                                                type: 'json',
                                                allowSingle: false,
                                                writeAllFields: true,
                                                rootProperty: 'data'
                                            }
                                        });
    
    
                                        var attachedFilesStore = Ext.StoreManager.lookup('attachedFilesStore');
                                        if(!attachedFilesStore) {
                                            attachedFilesStore = Ext.create('JBApp.store.AttachedFiles');
                                        }
                                        //var attachedFilesStore = Ext.create('JBApp.store.AttachedFiles');
                                        attachedFilesStore.setProxy(proxy);
                                        attachedFilesStore.load(function(records, operation, success) {
                                                console.log('load function:loaded attachment records');
                                                console.log(records);
                                            }
                                        );
                                        form.attachedFilesStore = attachedFilesStore;
                                        var attachmentsGrid = form.lookupReference('attachmentsGrid');
                                        //var grid = attachmentsGrid.lookupReference('fileGrid');
                                        attachmentsGrid.setStore(attachedFilesStore);
    
    
                                        //var attachmentsGridInAuditForm = form.auditForm.lookupReference('attachmentsGrid');
                                        //var gridInAuditForm = attachmentsGridInAuditForm.lokupReference('fileGrid');
                                        //gridInAuditForm.setStore(attachedFilesStore);
                                        form.auditForm.up().up().query('grid')[1].setStore(attachedFilesStore);
    
    
    
    
                                        //attachedFilesStore.reload();
    
    
    
    
                                    }
                                    //attachedFilesStore.reload();
                                    //Ext.getCmp('fileAttachGrid').getView().refresh();
                                },
                                failure: function (form1, action, a, b, c) {
                                    alert("file upload failure");
                                    //form1.attachedFilesStore.reload();
                                    //Ext.getCmp('fileAttachGrid').getView().refresh();
                                }
    
    
                            });

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    So the failure function is called but the JSON object is for a success?

    Regarding the file download, what content type are you using to send the data?

  3. #3
    Sencha Premium User
    Join Date
    Mar 2011
    Location
    Philadelphia
    Posts
    44

    Default

    Same exact thing is happening to me. This is a big pain for our team.

  4. #4

    Default Did you solve this issue? I am having the same problem

    I am having the same problem with Ext 4.2.
    Can you help?

    Quote Originally Posted by sameertj View Post
    A form submit is used to upload a file(a restful webservice is called).
    The file upload works fine in Chrome and the success callback function is invoked.

    Howver in Internet Explorer 11, the failure function is called. The below is the JSON object that is returned.

    {"message":"","success":true,"rowsInserted":1,"rowsDeleted":0,"rowsUpdated":0,"emailSent":0,"exception":null,"auditNumber":326}

    Moreover after the failure function is called in Internet Explorer the browser gives an option to download the json file.

    Below is the form.submit code.

    Code:
    form.submit({
                                url: AppConstants.baseUrl+'add-attached-file',
                                waitMsg: 'Uploading file...',
                                standardSubmit:false,
                                //contentType: "application/x-www-form-urlencoded;charset=utf-8",
                                //headers: {'Content-Type':'multipart/form-data; charset=UTF-8'},
                                success: function (form1, action, a, b, c) {
                                    //console.log('success uploading file');
                                    //msg('Success', 'Processed file "' + o.result.file + '" on the server');
                                    if(form.attachedFilesStore)
                                    {
                                        form.attachedFilesStore.reload(function(records, operation, success) {
                                            console.log('reload function:loaded attachment records');
                                            console.log(records);
                                        });
                                    }
                                    else {
                                        var auditNumber = Ext.decode(action.response.responseText).auditNumber;
                                        if(!form.auditNumber)
                                        {
                                            form.auditNumber = auditNumber;
                                            form.auditForm.getViewModel().set('auditMain.auditEntity.auditNumber',auditNumber);
                                        }
                                        var proxy = new Ext.data.proxy.Ajax({
                                            type: 'ajax',
                                            useDefaultXhrHeader: false,
                                            api: {
                                                read: AppConstants.baseUrl + 'get-attached-files?audit_number='+auditNumber
                                            },
                                            reader: {
                                                type: 'json',
                                            },
                                            writer: {
                                                type: 'json',
                                                allowSingle: false,
                                                writeAllFields: true,
                                                rootProperty: 'data'
                                            }
                                        });
    
    
                                        var attachedFilesStore = Ext.StoreManager.lookup('attachedFilesStore');
                                        if(!attachedFilesStore) {
                                            attachedFilesStore = Ext.create('JBApp.store.AttachedFiles');
                                        }
                                        //var attachedFilesStore = Ext.create('JBApp.store.AttachedFiles');
                                        attachedFilesStore.setProxy(proxy);
                                        attachedFilesStore.load(function(records, operation, success) {
                                                console.log('load function:loaded attachment records');
                                                console.log(records);
                                            }
                                        );
                                        form.attachedFilesStore = attachedFilesStore;
                                        var attachmentsGrid = form.lookupReference('attachmentsGrid');
                                        //var grid = attachmentsGrid.lookupReference('fileGrid');
                                        attachmentsGrid.setStore(attachedFilesStore);
    
    
                                        //var attachmentsGridInAuditForm = form.auditForm.lookupReference('attachmentsGrid');
                                        //var gridInAuditForm = attachmentsGridInAuditForm.lokupReference('fileGrid');
                                        //gridInAuditForm.setStore(attachedFilesStore);
                                        form.auditForm.up().up().query('grid')[1].setStore(attachedFilesStore);
    
    
    
    
                                        //attachedFilesStore.reload();
    
    
    
    
                                    }
                                    //attachedFilesStore.reload();
                                    //Ext.getCmp('fileAttachGrid').getView().refresh();
                                },
                                failure: function (form1, action, a, b, c) {
                                    alert("file upload failure");
                                    //form1.attachedFilesStore.reload();
                                    //Ext.getCmp('fileAttachGrid').getView().refresh();
                                }
    
    
                            });

  5. #5
    Sencha Premium User
    Join Date
    Mar 2011
    Location
    Philadelphia
    Posts
    44

    Default

    @machetico it ended up being a problem in our back-end code. From what I can tell the Sencha code works fine but we are on version 6

Similar Threads

  1. Replies: 2
    Last Post: 18 Jan 2015, 12:16 AM
  2. [NOREPRO] Ext.form.Panel submit doesn't work properly - always calls "failure" callback
    By szimek in forum Sencha Touch 2.x: Bugs
    Replies: 2
    Last Post: 17 Dec 2012, 8:24 AM
  3. [CLOSED] Internet explorer form submit bug
    By livensnick in forum Ext:Bugs
    Replies: 3
    Last Post: 3 Jul 2012, 2:17 AM
  4. Replies: 11
    Last Post: 29 Jun 2012, 11:00 AM

Tags for this Thread

Posting Permissions

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