PDA

View Full Version : filefield of form panel is not work in MVC architecture



volcom721
11 Jul 2012, 12:30 AM
Hello Sencha:
I have a problem there, i find the filefield of form panel is not work in MVC architecture, but if i use filefield in a normal architecture is work fine, but in MVC architecture does not.:-/ Is there has some parameter need to added when i use filefield in MVC architecture.

thanks

scottmartin
11 Jul 2012, 10:27 AM
Can you define .. not working?

Are your actions defined in your controller and you are not getting access as expected?

At the end of the day, MVC is just to organize your code. It should not affect how the control works unless you are not providing the correct access as mentioned.

Scott.

volcom721
12 Jul 2012, 12:30 AM
The "no work" is that the file not be sent to server. If i use MVC architecture like Function 2,
file not be sent to server(i check this by use tool "wireshark", and there is no data will be transmission),
but if i use normal architecture Function 1, the file will be sent.




#Function 1
{ text: 'Sent', action: 'submitImportAcc', width: 80,
handler: function() {
var form = this.up('form').getForm();
if(form.isValid()){
form.submit({
url: '../nasSvr.php?func=accountMgr&op=importAcc',
method: 'POST',
success: function(f, a) {
console.info(a);
var reMsg = Ext.JSON.decode( a.response.responseText );
Ext.Msg.show({
title: 'Information',
msg: reMsg.msg,
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.INFO
});
}
});
}
}
}


#Function 2
init: function(){
this.control({
'importaccwinv button[action=submitImportAcc]':{
click:this.submitImportAcc
}.......


submitImportAcc: function(btn, e){
var basForm=Ext.getCmp('ImportAccFormId').getForm();
if(basForm.isValid()){
btn.up('window').close();
basForm.submit({
url: '../nasSvr.php?func=accountMgr&op=importAcc',
method: 'POST',
success: function(f, a) {
Ext.Msg.show({
title: 'Information',
msg: a.response.responseText,
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.INFO
});
},
failure: function(f, a){
Ext.Msg.show({
title: 'Failure',
msg: a.response.responseText,
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
});
}//eo basForm.isValid()
}
},

tvanzoelen
12 Jul 2012, 12:51 AM
Do not know, but if you do this btn.up('window').close(); and the form is on the window, maybe its data gets lost.

Thats a difference I see compared to function 1. What if you take it out, or set it after the form is submitted?

volcom721
12 Jul 2012, 5:54 AM
I am so thanks for tvanzoelen (http://www.sencha.com/forum/member.php?32684-tvanzoelen), you are right. Close the window after server response, and that work.
Thanks you.

volcom721
12 Jul 2012, 6:00 AM
Sorry, how to close this question?

tvanzoelen
12 Jul 2012, 6:02 AM
Just mark the best answer. Then the thread is marked and people can find an answer if they have a similar problem

scottmartin
12 Jul 2012, 8:17 AM
Done ;)

Scott.