View Full Version : Sending parameters via POST during form.submit with filefield

30 Jan 2013, 8:12 AM

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:

Ext.define('BulkSearchForm' ,{
extend: 'Ext.form.Panel',
alias: 'widget.bulkSearchForm',
border: false,
layout: 'absolute',

initComponent: function () {

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) {
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 Jul 2013, 8:12 AM
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

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