1 2 Previous Next 23 Replies Latest reply on Jul 28, 2017 5:38 PM by davidav

    OnObjectEnter script trigger is delayed on a Pop-up Menu

    Ward

      Summary

      OnObjectEnter script trigger is delayed on a Pop-up Menu

      Product

      FileMaker Pro

      Version

      11.0v2

      Operating system version

      Mac OS X 10.6.4

      Description of the issue

      An OnObjectModify script trigger fires whenever a Pop-up Menu is selected, even if the current menu selection is not changed, i.e., click the menu but don't select a new item.

      I though I could test for an actual change:

      1.  Add an OnObjectEnter trigger to the menu field to capture the current value in a global variable.
      2.  In an OnObjectModify or OnObjectSave script, compare the current field value with the initial value (the global variable).

      However, the OnObjectEnter script is not triggered when clicking on the menu.  The trigger fires only when a new menu item is selected (an actual change) or when the record is committed (no change).

      Steps to reproduce the problem

      (see Description)

      Expected result

      In a Text field, the OnObjectEnter trigger fires the moment the field is selected.  It seems to me a Pop-up Menu should behave the same way.

      Actual result

      (see Description)

      Exact text of any error message(s) that appear

      (not applicable)

      Workaround

      So far, the best solution I can find to test for actual modification of a Pop-up Menu field is to capture the initial value with a OnRecordChange script trigger.  That's OK for a single field, but it gets tedious for multiple fields, each with a separate global variable.

        • 1. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
          philmodjunk

          I was intrigued by your post so played around with this trigger and I've figured out a workaround you can use.

          Pass the value of the popup menu field to the script trigger script as a parameter. The value passed, which you can access with Get ( ScriptParameter ), will be the "before" value so you can capture it and compare it to the newly selected "after" value from the popup menu.

          1 of 1 people found this helpful
          • 2. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
            Ward

            Thanks, Phil, for your inspired workaround!

            I gave it a thumbs-up rating.  I'm holding off choosing it as Best Answer, hoping a FileMaker person will acknowledge the current OnObjectEnter behavior is a bug that will be fixed.

            • 3. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
              TSGal

              Ward:

              Thank you for your post.

              Here is some information I received from Development:

              "The OnObjectEnter event with a Pop-up acts differently than say a Drop-down list.  The pop-up opens immediately, while the mouse is still down; but the drop-down list opens only after you are finished with the mouse action.  So, the mouse down causes the enter and pop-up as part of the same user event, but in the drop-down (and other cases) there is a user event that causes the field to be entered, but only after that event is finished do we open the drop-down list.  This also occurred with FileMaker Pro 10."

              If you tab to the pop-up field, then the OnObjectEnter event will activate immediately.

              An OnObjectModify event will not trigger if you select the pop-up and not check anything (that is, click outside).  If you select the same value, it will remove the existing value and replace it with the same value, thereby activating OnObjectModify.

              The suggestion by PhilModJunk to pass the (old) field value as a script parameter with OnObjectModify is excellent.

              TSGal
              FileMaker, Inc.

              • 4. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
                philmodjunk

                "If you tab to the pop-up field, then the OnObjectEnter event will activate immediately."

                That's not good news. Having such a script trigger work differently depending on whether it's a keyboard action or a mouse action is an interface inconsistency that can create problems for the user and developer. A future release that treats both identically (and documents the change) would be a very good thing IMO.

                • 5. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
                  TSGal

                  PhilModJunk:

                  Your comments are noted and sent back to Development and Testing for further review.

                  TSGal
                  FileMaker, Inc.

                  • 6. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
                    Ward

                    Thanks, TSGal, for passing this topic to the development team and posting their response.

                    I agree with PhilModJunk -- script trigger action should NOT depend on how the popup menu is activated.

                    I'm also disappointed with the the team's response, which seems to focus on how the FileMaker code is written, not on how it should behave.  The current inconsistent behavior appears to be an accident of implementation rather than carefully considered design.

                    I encourage the development team to reconsider what OnObjectEnter really means and fix the behavior w.r.t. popup menus.

                    PhilModJunk's excellent workaround is just that, a workaround, not a fix to broken behavior.

                    -- Ward

                    • 7. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
                      LaRetta_1

                      I agree as well.  It is a bug and needs to be fixed.  I am disappointed in the FMI response as well but  not at all surprised, unfortunately.

                      • 8. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
                        TSGal

                        Ward:

                        I have also attached your last comments to the case.

                        The case has been sent to Development for review.

                        TSGal
                        FileMaker, Inc.

                        • 9. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
                          chads.

                          I'm going to throw my two cents in here too, at the risk of beating a dead horse.

                          I consider this a bug without any ambiguity.  It works exactly opposite to the way the documentation says (see "Setting up script triggers" and "onObjectEnter").  In both cases, there is no mention of this odd behavior.  And mentioning it in the documentation, or giving an explanation of why it's broken and a workaround is not adequate.  It's just clear that it's wrong and broken.  I appreciate a way to work around the specific problem of the original poster, but this is a bigger problem than not being able to capture the initial state of the field.  We should be able to run triggers in an expected order.

                          I realize that we have to wait for the next point release, to see this resolved, and I hope that we don't have to wait for FileMaker 12 or later to resolve this.

                          • 10. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
                            Ward

                            I appreciate TSGal's passing along our additional comments to the development team.

                            I'm sure we'd all sleep better if the developers responded, acknowledging that the current Pop-up menu trigger behavior is a bug that will be fixed.

                            As I write this, I wonder whether Dropdown list triggers behave as expected. I'll check into this when I have some spare time.

                            • 11. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
                              TSGal

                              Chad Sager:

                              Thank you for your comments.  I have also attached your post to the case.

                              There are no additional comments from Development about this issue.

                              TSGal
                              FileMaker, Inc.

                              • 12. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
                                DaleYoung

                                     This behavior is still NOT fixed in FileMaker 12. I'm using FM Pro Advanced 12.0v2 and it does not execute the OnObjectEnter script before the field is changed, as is documented and as it works with other types of fields.

                                • 13. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
                                  JaredSorge

                                       I can report that this is still an issue in FileMaker 13 Advanced. Disappointing.

                                  • 14. Re: OnObjectEnter script trigger is delayed on a Pop-up Menu
                                    scottworld

                                         Thanks, Phil, for this ingenious workaround:

                                         

                                              I was intrigued by your post so played around with this trigger and I've figured out a workaround you can use.

                                         

                                              Pass the value of the popup menu field to the script trigger script as a parameter. The value passed, which you can access with Get ( ScriptParameter ), will be the "before" value so you can capture it and compare it to the newly selected "after" value from the popup menu

                                         The fact that Phil's workaround works shows that this OnObjectEnter script trigger is completely broken in all versions of FileMaker Pro, including version 13. If the SCRIPT PARAMETER can see the previous value of the field, then the OnObjectEnter script trigger should be able to see the previous value of the field as well.

                                    1 2 Previous Next