1. #1
    Sencha User
    Join Date
    Jan 2012
    Location
    New York City
    Posts
    109
    Answers
    1
    Vote Rating
    2
    infernoz is on a distinguished road

      0  

    Default Unanswered: Sending parameters via POST during form.submit with filefield

    Unanswered: Sending parameters via POST during form.submit with filefield


    Hello,

    I have a form that has a filefield xtype as one of its items. I'd like the file to be sent to the server during the submit. I'd also like additional parameters to be sent to ther server during the submit as well.

    What I noticed is that when I have the filefield as an item in my form, the parameters arent being sent to the backend. How can I get both the file AND the additional params passed to the server via a POST?

    I am using ExtJS 4.1.0. Here is a snippet of the code:

    Code:
    Ext.define('BulkSearchForm' ,{
        extend: 'Ext.form.Panel',
        alias: 'widget.bulkSearchForm',
        border: false,
        layout: 'absolute',
        
        initComponent: function () {
            this.callParent(arguments);
        },
        
        items: [
                {xtype: 'filefield',
                 name: 'bulksearchfile',
                 fieldLabel: 'Search File',
                 labelWidth: 75,
                 msgTarget: 'side',
                 allowBlank: false,
                 anchor: '60%',
                 x:1, y:5
                },
                {xtype: 'button', id: 'submitBulkSearchButton', text: 'Bulk Search', width: 100, x:410, y:5,
                    handler: function() {
                        var form = this.up('form').getForm();
                        var processorTypeVar = this.up('form').up().up().up().searchProcessorName;
                if (form.isValid()) {
                form.submit({scope: this, waitMsg:'Searching', url: '/CMPDataManagementTool/bulksearch.html',
                                params: {returnFileType: 'filledForm', processorType: processorTypeVar},
                                success: function(form, action) {},
                                failure: function(form, action) {
                                    Ext.Msg.show({
                                           title:'DMT Search',
                                           msg: 'An error has occured while searching for data. Please contact support or try again.',
                                           animateTarget: this,
                                           icon: Ext.Msg.ERROR,
                                           buttons: Ext.Msg.OK
                                    });
                                }
                            });
                        }
                    }
                },
    
     ..... .... Here are some other buttons that work properly that dont use the filefield......
    
    });
    I think using form.doAction() actually works with this setup above, but I want to take advantage of the success: and failure: components of the submit() function and the grey-out feature that occurs during form.submit() where a user cant do anything but wait for the form submit to return.

  2. #2
    Sencha Premium Member
    Join Date
    Mar 2007
    Posts
    170
    Answers
    3
    Vote Rating
    1
    mike1993 is on a distinguished road

      0  

    Default


    perhaps, it was an issues w/ 4.1.0. It works fine w/ 4.2.1
    But I found a snippet in old code. There is no mention of baseParams in current docs though

    Code:
     var uploadForm = new Ext.FormPanel({
            autoHeight: true,
            method: 'POST',
            url: '/cgi/importFile.cgi',
            baseParams: {
              sid: sid,
              upload_type: "ATTACHMENT"
            },
            ..

Thread Participants: 1

Tags for this Thread

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