5 Replies Latest reply on May 24, 2013 6:59 AM by disabled_xaviervb

    Unaccessible pop-up menu

      Hi all

       

      I would like to make a pop-up menu in a portal unaccessible if a condition is not met.

      Idealy the pop-up menu would not pop-up

      Otherwise if the user can see the values of the pop-up menu he can't change the original value.

       

      I tried a revert record script step but it reverts all the other changes the user has done in the portal.

       

      I would like this to happen through script triggers because I 'm developping with the data separation model.

       

      Any advice?

      Thanks

       

      Xavier

        • 1. Re: Unaccessible pop-up menu
          mikebeargie

          You could use the "OnObjectEnter" script step to checks for your condition when a user tries to activate the drop down field, and then uses "Go To Object" to go to a different object if the condition is invalid. IE, you force them to not be able to access the field via script trigger based on your condition. Make sure your script has an "allow user abort - OFF" script step in there as well.

          • 2. Re: Unaccessible pop-up menu
            jbante

            That wont quite work. The OnObjectEnter trigger doesn't fire on a pop-up menu or drop-down list until after the menu/list closes (either by the user making a selection or clicking on a blank part of the layout, leaving the field active).

             

            The "data separation model" means different things to different people, but most interpretations I know of don't create any reason to put more logic in scripts vs. schema. Certainly many folks who use separated file architectures also aspire to put as much logic in scripts as possible, but the latter does not necessarily follow from the former. What is the condition in which users should be able to edit the field? It might be more appropriate to make the field inaccessible under that condition using FileMaker's native security features (in the data file). Note that security at the record level can be determined by calculation, but security at the field level cannot. It might be worth considering spinning that field off into a separate table with a one-to-one relationship with the portal table to take advantage of security based on a calculated condition.

             

            If really want to stick to scripting, you can take advantage of the quirky order of operations for the OnObjectEnter trigger:

            1. The user clicks on the field
            2. The script parameter calculation evaluates
            3. The pop-up menu displays
            4. The user makes a selection
            5. The triggered script fires with the parameter set in 2.

            Using this, you can capture the original value of the field with the script parameter, and set it back in the triggered script:

             

            Script Parameter:

            Get ( ActiveFieldContents )

             

            Script:

            If [$$~TRIGGERS_DISABLE]]

            # Exit disabled trigger, per best practices

            Exit Script [True]

            End If

            If [not IsEmpty ( Get ( ScriptParameter ) ) // or use your own condition here]

            # Don't specify the field, so the step will target whatever the active field is

            Set Field [Get ( ScriptParameter )]

            End If

            Exit Script []

            1 of 1 people found this helpful
            • 3. Re: Unaccessible pop-up menu
              RubenVanDenBoogaard

              Hi Xavier,

               

              an other method you could use is to disable access to the popup field and put a button on to of the field.

              If the button is pressed and the conditions are met, you can use the go to popup field step to open the popup menu.

               

              Hope that helps,

               

              Best regards,

               

              Ruben van den Boogaard

              Infomatics Software

              ruben@infomatics.nl

              • 4. Re: Unaccessible pop-up menu
                mikebeargie

                you're right, I didn't register that Xavier noted that he wanted a popup.

                 

                If drop downs are acceptable though, here's a demo of that trigger (which DOES work on drop down menus).

                1 of 1 people found this helpful