View Full Version : Cannot submit form with file and checkbox

5 Jan 2011, 3:13 PM

I have a form:

xtype: 'form',
itemId : 'upload_form',
labelWidth: 50,
fileUpload: true,
frame : true,
autoHeight : true,
buttonAlign : 'center',
items : [
xtype: 'fileuploadfield',
id: 'form-file',
anchor: '100%',
allowBlank: false,
emptyText: 'Select an image',
fieldLabel: 'Photo',
vtype: 'image',
name: 'photo-path',
buttonText: '',
buttonCfg: {
iconCls: 'image-add-icon'
xtype: 'checkbox',
boxLabel: 'check me!',
anchor: '100%',
hideLabel: true
buttons : [
xtype : 'button',
text: 'Upload',
handler: this.onUpload,
scope: this

onUpload : function() {
var uploadForm = this.getComponent('upload_form').getForm();
console.log('uploadForm.isValid(): ' + uploadForm.isValid());
if (uploadForm.isValid()) {

I choose an image and when I click on 'Upload' button I can see on the console log that the form is not valid, so it cannot be submitted. Can someone tell me what is wrong? If I comment out the checkbox, everything is fine, form is submitted and file is uploaded properly.
(xtype: 'fileuploadfield' is exactly the same what can be downloaded from http://dev.sencha.com/deploy/dev/examples/form/file-upload.html)