Below is my popup window onclick of a button. After choosing and clicking the Upload button I am unable to submit the form.
function uploadStockDetails(){
try{
var stockAuditUploadFile = Ext.widget('window', {
title: 'Upload the Stock Audit file',
closeAction: 'hide',
width: 400,
autoHeight: true,
layout: 'fit',
resizable: false,
modal: true,
items: [{
xtype: 'filefield',
name: 'file',
fieldLabel: 'File',
labelWidth: 50,
msgTarget: 'side',
allowBlank: false,
anchor: '100%',
buttonText: 'Browse'
}],
buttons: [{
text: 'Upload',
handler: function() {
alert('asdhj');
var form = stockAuditUploadFile.getForm();
alert(form);// not reachable. No alert appearing.
if(form.isValid()){
form.submit({
url: 'StockAuditUpload',
waitMsg: 'Uploading your file...',
success: function(fp, o) {
Ext.Msg.alert('Success', 'Your file has been uploaded.');
}
});
}
}
}]
});
stockAuditUploadFile.show();
} catch(e) {
alert("Exception in uploadStockDetails"+e.message);
}
}
The other ways I tried to submit the form were
this.up('form').getForm();
this.prev('form').getForm();
this.ownerCt.down('form').getForm();
All the above methods didn't give me desired results. I feel that I have made a mistake in creating the window and that I should create a form rather.
Can anyone please suggest?