2 Replies Latest reply on Mar 28, 2014 9:51 AM by ScottWalker

    FMP12: Problem with OnObjectValidate trigger

    ScottWalker

      Title

      FMP12: Problem with OnObjectValidate trigger

      Post

           Hi - I have a form with several fields and have to control the order in which the focus changes among the fields based on entered values. Most of the fields are drop down lists with a set list of values. For these I use an OnObjectModify script trigger; the script sends the user to the correct next field based on the chosen value. These work fine. I have one field where the users are allowed to type in values in addition to the options available in the drop-down. I can't use OnObjectModify here, because it triggers at every keystroke, not when they are done typing. It seems like OnObjectValidate or OnObjectSave should work, but the trigger does perform as expected. Here is my desired set of actions:

           1. User selects or types value into field

           2. Focus goes to field (with Go to field script step) and selects all.

           If I set the trigger to OnObjectModify, it works as expected, though the user is then limited to the options in the drop-down or a one-character entry. If I set the trigger to OnObjectValidate or OnObjectSave,  the focus does not go to the field in the script. I have verified that it is triggering the script - I put in a test Custom Dialog step above the Go To Field, and the dialog pops up. It just doesn't then go to the field. Any ideas why it is working for OnObjectModify but not OnObjectValidate?

            

        • 1. Re: FMP12: Problem with OnObjectValidate trigger
          philmodjunk

               Take a look at the info in "Setting up Script Triggers" in FileMaker Help.

               Some triggers, such as OnObjectModify, are tripped after FileMaker processes the event that tripped the trigger. Others, such as OnObjectValidate and OnObjectSave, process the event after the script performed by the trigger is performed. Thus, the user presses a key or clicks the mouse to exit the field, the script is performed that puts the cursor into the desired field, but then the mouse click or keystroke event is processed and the focus changes to the clicked object or the next field in your layout's tab order.

               To keep FileMaker from processing the triggering event, add an Exit Script [False] Step to the end of your script to cancel out the triggering event.

          • 2. Re: FMP12: Problem with OnObjectValidate trigger
            ScottWalker

                 Thanks! That fixed it. To clarify for any others that encounter this: after the Go to Field step in the script, add an Exit Script step and enter "False" as the script result. It will show as Exit Script[Result: "False"]