PDA

View Full Version : How to handle form submit exceptions?



mcadirci
6 Mar 2011, 6:28 AM
Hello,

I have a common form panel. My question is when I submit it, how can handle if server responses nothing instead of some json?

Some help would be great.

Thanks.

brittongr
8 Mar 2011, 1:18 PM
this doesn't work?



formPanel.getForm().submit({
...,
failure: function(response, action)
{
alert('Failure');
}
})

mcadirci
8 Mar 2011, 11:05 PM
If json format is invalid that doesn't work.
like:
{
success:true,
par1:,
par2:'val'
}

jwaiwit
13 Mar 2011, 6:27 PM
I modified ext-all-debug.js line 4233 for

near a line 4233

doDecode = function(json){
return eval("(" + json + ")");
}

to

doDecode = function(json){
try
{
return eval("(" + json + ")");
}
catch (e)
{
return {success:'false',message:'invalid json'};
}

}