1. I'm being a bit ignorant in not understanding exactly what 'Exit Script [ Result: False ]' does?
The Exit Script result is the key to stopping the user from moving to a different tab panel.
The FileMaker routine that called your script pays attention to the Exit Script result value.
If the result is False, the user's attempt to move to a different tab is ignored.
If it is True, the user succeeds.
There's no need for the Else clause in your second example. If the triggering action isn't canceled, then FileMaker will proceed to go to the next tab panel.
Thank you both.
However, the tab_calcs part of the scrip still doesn't prevent a user moving off it without completing critical fields. Might this be because those fields are in a portal from a related table?
Didn't mention that before. Makes a difference. Here's why:
When you evaluate a related field via a calculation, FileMaker always chooses the first related record. So if your user is entering data in a different related record, then referencing Calc::cm won't see it. It will see that field in the first related record instead, pass the validation, and move on.
To fix this, you need to change your validation method to OnObjectExit or OnObjectSave or OnObjectModify, depending on your exact need. Or, you need to fetch all related records and loop over them using the List ( ) function, verifying proper entry. Or both. It all depends on what your business rules are.
Thanks, that confirms a suspicion.
There's a 'calc' portal on the 'tab_calcs' panel, are you saying have a script preventing movement off that object (portal) until critical fields are filled?
Actually I'd need a 'object' containing a record within the portal to refer to wouldn't I?
The object is any field you want to verify before moving on.
I'd specified validation rangs, but forgotten 'not empty'; thanks.