PDA

View Full Version : form submit using controller in Mvc



mukund1a
1 Nov 2011, 10:27 PM
App.views.UsersList = Ext.extend(Ext.Panel, {
initComponent: function(){
//some code here
App.Registerfrom = new Ext.form.FormPanel({
height: 899,
id:'register',
layout: //some lay out
items: [fields],
listeners: {
beforeactivate: function() {
var model = this.getRecord();
}
}
});
//some handler in submit button
connectdb:function()
{
var regVal = App.Registerfrom.getRecord();
Ext.dispatch({
controller: 'Register',
action :'testing',
data : App.Registerfrom.getValues(),
record : regVal
,form : App.Registerfrom
});
}
now in side controller in controller.js---------
Ext.regController('Register',{
testing:function(params){
var el=data;
alert(el);
if(navigator.onLine){
params.form.submit({ //probably some mistake
url:'someurl.php'
waitMsg : {message:'submitting', cls : 'loading'},
success : function(){alert('success');},
failure : function(){alert('fail');},
scope : this
});
}
}
});

the submit function is not working............plz help

mitchellsimoens
2 Nov 2011, 6:07 AM
is it hitting the controller?

mukund1a
2 Nov 2011, 9:01 PM
no ....i want to use controller so that it is easy for programmer

mitchellsimoens
3 Nov 2011, 5:04 AM
I suggest you set a breakpoint when you call Ext.dispatch and see where it stops as by looking at these code snippets, it should work.