to achieve your goal, you need to leave "save records changes automatically" ticked. Plus you need to attach a script to the OnRecordCommit script trigger. If your script returns False, then the commit is cancelled, and if it returns True the record commit will proceed.
Thanks planteg. Would you mind elaborating slightly on the script? and will this only run when the user leaves the record?
the script will fire any time an action from the user will prompt a commit.
Here is how I handle that - I hate auto-commit .
- I add two buttons to my layouts: [Cancel] and [Save]
- The script triggered by OnRecordCommit will return False if a Global Variable isn't set to Allow Commit
- When I click on [Save], I change the Global Variable to Allow Commit, call Commit Records/Requests and set back the Global variable
- When I click on [Revert], I simply call Revert Record
If you want to get fancier, you may hide both buttons if no change is made to the record .
thanks planteg, at what point do you generate an alert asking you to save or revert? The user is interested in having this when you leave a record that has undergone changes.
Unfortunately, there is no "OnRecordExit" trigger. I haven't seen a good implementation of what you're trying to do.
My routine is similar to yours
the difference is that I Set to false the global variable in the event OnLayoutEnter
But I also hate auto-commit stinks
I'm not convinced the test result but im going to probe greetings