5 Replies Latest reply on Oct 20, 2010 10:26 AM by Bricktop

    Validate By Calculation

    Bricktop

      Title

      Validate By Calculation

      Post

      Hi All,

      I needed some help with what I think is a validation. I just want the user to confirm if any changes are made to a field. By mistake I changed a field from a drop down menu and I had a heck of a time trying to figure out where I went wrong. I just want to make the field say something like "are you sure you want to change this field?" and then allow the change (yes) or revert it back (no).

      Thanks

      Steve

        • 1. Re: Validate By Calculation
          philmodjunk

          If you are using FileMaker 10 or 11, you can use script triggers for this.

          Script 1

          Set Variable [$$PrevValue; Value: YourTable::YourDropDownField ]

          Script 2

          Show Custom Dialog ["Are you sure you want to change..."]
          If [Get ( LastMessageChoice ) = 2 /* Cancel was clicked */ ]
             Set Field [ YourTable::YourDropDownField ; $$PrevValue ]
          End If

          Set the first script to be performed by the OnObjectEnter trigger. Set the second to be performed by OnObjectSave. These scripts will not work with pop up menus. A different script 1 must be used to save the initial value.

          • 2. Re: Validate By Calculation
            philmodjunk

            You could also use this validation calculation:

            False

            with this custom validation message: Are you sure you want to change this value?

            And leave "Allow user to override..." enabled. It's a bit clunkier as you get an extra message asking you to confirm that you want to revert the record, but it also sets this up at the Data level which means it will happen on any layout where you place your field.

            • 3. Re: Validate By Calculation
              Bricktop

              I want to try and use validation calculation because it seems easier, and I'm a newbie but, I don't get what your saying about false validation calculation.

              • 4. Re: Validate By Calculation
                philmodjunk

                With the validation calculation consisting of just the single word False, all data entered will trip the validation error and then the custom validation message pops up. It's a way to trick the system into using a validation rule to pop up a confirmation message.

                Note: False entered in a calculation expression without any enclosing quotes will be recognized by a FileMaker as a keyword with the value of 0.

                • 5. Re: Validate By Calculation
                  Bricktop

                  Cool Thanks I get it now, hopefully that explantion will help me with other calculations!!!