Any other way to cancel form submission other than setAbortAction?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 05:10 AM
Hi all,
Is there any other way to cancel form submission other than setAbortAction?
This method leaves us with the 'invalid update' message which ideally I would like to eliminate, but other than a different form of cancellation, I can see no way.
Any help would be much appreciated.
Kind regards,
G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 05:30 AM
Hi @gunishi ,
If it's at Client side then yes:
Here’s a simple example that aborts submission of the user tries to submit a high-priority incident.
if(g_form.getValue('priority') == 1){
alert('Record submission aborted.');
//Make sure dirty form still works
g_form.submitted = false;
//Abort the submission
return false;
}
}
For Server Side, setAbortAction is best:
Server-side validation is also very simple. The primary difference with server-side validation is that it works in a business rule. Because of that, the syntax is slightly different. The most important part of this type of validation is that your business rule has a ‘When’ value of ‘Before’…so that your business rule runs before insert or update…otherwise the database action will have already taken place by the time your script runs.
Server-side aborts make use of the ‘setAbortAction’ method. SetAbortAction simply tells the system to abort the next database action (insert, update, or delete) for the record it is used against. Here’s an example script and screenshot of setAbortAction in a ‘Before’ business rule.
current.setAbortAction(true);
}
Whenever I use this method I always add another information message so it is clear to the user what happened.
gs.addInfoMessage('Record submission aborted.');
current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 07:06 AM
Hi @gunishi ,