4 Replies Latest reply on Jan 27, 2009 7:47 AM by sschwartz_1

    FMP10 script trigger bug?

    sschwartz_1

      Title

      FMP10 script trigger bug?

      Post

      As a test of the new script trigger feature, I created a simple script that I attached to a field formatted as a drop-down list. (The field's name is Type.) Depending on what the user chooses from the list, one of two possible Go To Field steps is executed.

       

      Here's the script:

       

      If [Checkbook::Type = "Check"]
         Go to Field [Checkbook::Number]
      Else
         Go to Field [Checkbook:: Date]
      End If 

       

      Unfortunately, it doesn't work. No matter what the user chooses from the drop-down list, the next field in the tab order is automatically selected. (It happens to be the Number field.) When I test the script in the Script Debugger, it works flawlessly -- just not when I attempt to run it normally. I get the same result when I test this using OnObjectModify, OnObjectSave, or OnObjectExit.

       

      After messing with this for an hour and getting nowhere, I simply started "trying stuff." For some reason that I can't fathom, adding a Halt Script as the final step makes the trigger work correctly. Is this a bug related to using a script trigger in conjunction with Go to Field? (If I replace the Go to Field steps with something else, such as Speak or Beep steps, the trigger works without having to add the Halt Script step.) Or is this just something undocumented that I tripped over?

       

      Steve 

        • 1. Re: FMP10 script trigger bug?
          davidhead
            

          Hi Steve

          I just set up a sample file to test this out and I find that all is working as expected.

           

          I set the trigger script to fire OnObjectModify of the Type field. 

          • 2. Re: FMP10 script trigger bug?
            sschwartz_1
              

            Hmmm... You used a variation of my script above (minus the Halt Script step) and it worked??

             

            I've only tested this on a Mac. Same for you? (Note that the field to which the trigger is attached is formatted as a drop-down list. But I believe the result was the same even when it was attached to a normal text-entry field. Also, other step directives work fine. The only one that's causing a problem is Go To Field.)

             

            One last note... Probably irrelevant, but the Number field is next in the tab order to the trigger field (Type).

             

            Steve 

            • 3. Re: FMP10 script trigger bug?
              davidhead
                

              Hi Steve

              My script was identical to that which you posted. Five steps, no Halt.

              It was tested on a Mac running 10.5.6.

              The tab order of the fields was Type -> Number -> Date.

              The Type field was formatted as a drop-down list. 

               

              I did see a note explaining the Halt step behaviour:

               

              "When you execute the Halt Script script step with a "pre-event" trigger, Halt Script cancels the original event, similar to when False is returned from an Exit Script script step."

               

              So if you used a pre-event trigger such as OnObjectSave or OnObjectExit, the script will cancel the event. I would need to work out what the implications might be. But it may be a clue.

               

              In any event, it worked for me with OnObjectModify which is a post-event trigger. 

              • 4. Re: FMP10 script trigger bug?
                sschwartz_1
                  

                David,

                 

                I just tested it again and you're correct. It is now working with OnObjectModify (but not with OnObjectExit or OnObjectSave). Although I previously tried all three triggers many times and none of them worked, OnObjectModify works NOW -- so fixed is fixed.

                 

                I think you may be right and that OnObjectModify is the only post-event trigger of the three (although the names of the other two would imply that they're post rather than pre). I'm going to have to look at the explanations for script triggers more closely so I can get a solid grasp of which trigger is appropriate for which event, what constitutes an event, and the difference between pre and post events. In the meantime, thank you very much for testing this out.

                 

                Steve