This example has a variety of OnObjectEnter script triggers applied to it and is used to illustrate some of the example situations listed below.
Only some of the triggers are set to fire in both browse and find modes. The tab panel trigger only fires when tabbed into from the comments field. Some fields you cannot click into in Find Mode, so although their triggers are set to fire in Find mode, they cannot.
ABOUT OnObjectEnter SCRIPT TRIGGER
The OnObjectEnter script trigger will fire when the layout object it has been applied to becomes active, most likely by a mouse click, keyboard tab action, scripted action or if that field is first in the tab order when a new record or new find request is created.
Field behavior settings can come into play for the OnObjectEnter trigger. With the exception of scripting, the OnObjectEnter trigger would NOT fire if the field has its behavior setup so it cannot be clicked into. A script can still enter into a field regardless of its layout behavior setting. ( more info Field Behavior and Tab Order And Field Behavior Explored ).
Although a field is only placed in a portal row once in layout mode, clicking on or tabbing into the same field in different portal rows in browse mode would execute a trigger for each.
A portal can have a script trigger applied to it (because it is a layout object) and objects within the portal row can have triggers. Say a portal has a trigger and a field in the portal has a trigger. So clicking on a field in a portal the first time would cause a double whammy. First the trigger associated with the portal object would fire and then the OnObjectEnter associated with the field in the portal will fire.
Repeating fields have a similar behavior to portals. You can assign a script trigger to the repeating field and the OnObjectEnter will trigger each time you enter into one of the fields repetitions.
It is important to note how tab panels work in regards with the OnObjectEnter script trigger. Clicking (or the less known space bar activation) of the individual tabs in a tab panel does NOT cause the OnObjectEnter trigger associated with the tab panel to fire. Tabbing into a tab panel would cause the OnObjectEnter trigger to fire but I really don’t know how often users enter a tab panel via the keyboard tab key.
In a previous post, we discussed the difference between pre-triggers and post-triggers. The OnObjectEnter is a post-trigger, meaning that is will fire after the field has been clicked into and not before. (Makes sense, right?)
More info about the author and FileMaker in general, contact me at email@example.com.
© 2009 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.