8 Replies Latest reply on Feb 24, 2014 1:16 PM by ontarget

    Popovers and Script Trigger for On Object Enter

    taylorsharpe

      OK, I have a popover that when I open it, I want it to run a script. So I created the popover. Then I went to the Script Triggers for the object and the first Script Trigger is "On Object Enter". I assumed this would be the script that would trigger whenever someone clicked on the object and the popover opened. Apparently I was wrong. Clicking the object does not trigger the On ObjecT Enter script trigger. Does anyone know why? Do I misunderstand how this is supposed to work? How else would you trigger a script when opening a popover?

       

      FYI, I'm using a Mac OS X 10.8.5 with FileMaker 13.0v1.

       

      Thanks for any input or suggestions.

        • 1. Re: Popovers and Script Trigger for On Object Enter
          Mike Duncan

          On Object Enter works, but you need to attach the script trigger to the popover "balloon" and not the popover's button.

          • 2. Re: Popovers and Script Trigger for On Object Enter
            ninja

            I have the same question, but with a bit of twist...

             

            I set the trigger to On Object Enter...and the script creates a new record that I want populated via the fields on the popover.

             

            Click>

            Popover opens for a millisecond

            I have now entered, so a new record is made

            and the focus goes tho the new record (list view) and the popover is closed.

             

            So I add a GoToObject step in the script to get the popover open again...

            and I've now entered it again so a new record which then launches the script again...100 new records *presto*.

             

            How do I get the popover to open on a new record , that I can fill within the popover?

             

            I feel like I'm missing something really obvious...

            • 3. Re: Popovers and Script Trigger for On Object Enter
              ch0c0halic

              That kind of problem where a script in a script trigger causes a script trigger has been possible since script triggers were introduced.

               

              I solved it by checking a global variable only used in this script and if its set then exit script. If not set the script sets it and then does the other stuff. If the script is called again before the end of the script clears the global variable then it exits and the script continues. Just remember to clear it at the end of the script.

              • 4. Re: Popovers and Script Trigger for On Object Enter
                ninja

                Thanks Choco,

                 

                For anyone who finds the thread later...

                I did use a global variable.

                The OnObjectEnterscript now Checks the variable and

                 

                If it is empty or zero, make a new record and set the variable to 1, go to an object in the popup (to reopen the popup) and exit script.

                If the variable is 1, set the variable to zero and exit script.

                 

                This makes a new record (which closes the popup), reopens the popup with the variable =1, reruns the script OnObjectEnter and the script dumps out without reclosing the popup.

                There oughta be an easier way...and there might be...but this way works fine.

                • 5. Re: Popovers and Script Trigger for On Object Enter
                  jw00d

                  If the goal is to use the popover to ADD NEW RECORD, I find it easier to place Global fields on the popover instead of displaying an actual new record from a table. You can use the OnObjectEnter trigger to set all Globals to "". Use the Global fields to capture the data you need for your new record. Then place a button on the popover to run a script to add the new record based on the values in your Global fields.

                  • 6. Re: Popovers and Script Trigger for On Object Enter
                    jbante

                    The FileMakerStandards.org folks have a set of recommended custom functions for handling this sort of thing.

                    • 7. Re: Popovers and Script Trigger for On Object Enter
                      ninja

                      Thanks jw00d,

                       

                      I consiered that approach...definitely functional...but opted for one script instead of a bunch of extra globals.

                      • 8. Re: Popovers and Script Trigger for On Object Enter
                        ontarget

                        Hi So now it is the end of Feb 2014 and are we any smater about adding a new record using a popover? Adding globals and scripting to add a new record seems like a long way around. A simple script to add a new record and then return in the same script to the original layout seems easy.

                         

                        That being said, why are popovers not documented better? If they provide such a noval approach to popups why not have a section that explains the options better in the documentation. I've looked at all the documentation and what I found is minimal? Does snyone have a better reference than the Help, and the user guides?