PDA

View Full Version : Get comfirmation of a form submit



Aaryn015
4 Oct 2007, 5:00 PM
Hi all,

I have a form that works just fine and displays a waiting message. It also saves and retrieves data fine.

I'm just trying to figure out how to get the result status of a submit when a user clicks on the Save button. I found an thread on the issue and Animal gave a quick response of:

return {success: true, info: "Success"}

This seemed to help the original help request, but I can't work out the context in which this statement is used in the code. My attempts are all errors.

Here is the code for my Save button on the form:



// Add the save button that submits the form
siteInfoForm.addButton('Save Changes', function(){
if (siteInfoForm.isValid()) {
siteInfoForm.submit({
params:{
action:'submit',
id:defaultData.getAt(0).data.siteId
},
waitMsg:'Saving...',
});
}else{
Ext.MessageBox.alert('Errors', 'Please fix the errors noted.');
}
}, siteInfoForm);


Any help would be appreciated. I am just looking for a way to open a dialog to say the record was saved.

Cheers
Aaron

John Sourcer
4 Oct 2007, 11:10 PM
What about the following after params?


, callback: function(options, bSuccess, response){
try {
var o = Ext.decode(response.responseText);
}
catch (e) {
alert('Invalid server response');
}

if('object' != typeof o) {
// throw 'Invalid server response';
}
if(o.success = true) {
msg = 'The files you selected for download have been zipped into a single file for convenience.<br><br><span align=\"center\"><a href=\"../files/' + o.filename + '.zip\">Click here to download.</a></span>'
showDialog(msg);
}
else {
msg = 'An error has occurred. Please contact the system administrator';
}
}
});