1 of 1 people found this helpful
Possibly the OnRecordCommit script trigger on a layout. You can override the commit with the script step "Revert Record" with no dialog checked. Or you can use Exit Script result = "false" to block the commit attempt.
You might need to add a stately variable (IE $$state = "modal") to do some additional trapping to make sure it only applies to your modal window.
See the example at the following link
There are some other examples out there. Just google "filemaker transaction commit"
Thanks Mike and flukey. The Soliant article - though a bit dated now (it is in FMP 11, pre-Modal Windows) - was very helpful.
What I forgot to mention in my original post is that I want to prevent the record from committing if a user accidently clicks outside of a field and inadvertintly commits the record. In that case, clicking the Cancel button and Reverting the Record doesn't work (without the onRecordCommit, that is).
The onRecordCommit, along with a global variable, does the trick.
I was initially unclear of the order of scripts. Now I see that the button calls its script and inside that script I have a Close Window script step. This Close Window step calls the onRecordCommit script. Since there is no way to pass a parameter here (as far as I know), a global variable is used.
I like to tidy things up, so once I know whethere to Exit Script with 1 or 0, I then set a global variable: $$commit = "".
This technique is nice as it allows the following:
1. Click "Cancel" and revert the record.
2. Click outside a field in a modal window and then click "Cancel" and revert the record.
3. Click "Save" and save the changes to the record.
4. Click outside a field in a modal window and then click "Save" and save the changes to the record.
Good to hear it worked out!
Make sure to visit us at COFMUG in Columbus for a meeting sometime. It's not THAT far from Toledo!