PDA

View Full Version : Help with form submit...



stratis
23 Apr 2007, 2:00 PM
I try to submit a form in CF. I finally done it.. :) but... i noticed some things... when i give a wrong url i take a Validation failed message, when i return from CF nothing (empty spaces) or a misformed response i stuck with Please wait... for ever. I tried to handle this cases by adding

frmNewOrg.addButton('create', function(){
frmNewOrg.submit({
waitMsg: 'Processing Data, please wait...',
//reset: true,
reset: false,
success: function () {alert('sucess');},
invalid: function() {alert('invalid');},
failure: function(f,e) {
if (e.failureType == 'server') {
Ext.Msg.alert('Failure server', 'id:' + e.result.errors.id + ' - msg:' + e.result.errors.msg);
} else {
Ext.Msg.alert('Failure client', 'Validation failed');
}
},
scope: frmNewOrg,
// add some vars to the request, similar to hidden fields
params: {action: 'new'}
});
});
frmNewOrg.on('actioncomplete', function(form, action){
var type = action.type; // e.g. "load"
var data = action.result; // your full json data pre parsed
alert(0);
});
frmNewOrg.on('actionfailed', function(form, action){
if(action.type == 'submit' &&
action.failureType == Ext.form.Action.SERVER_INVALID){
// server side validation failed
alert(1);
}
});

but nothing is called... I noticed also in FF debugger that an error is generated that has to do with my bad response, but my question is ... how can i handle it with code in javascript?
Or shouldn't i?
pls hlp!!!!