4 Replies Latest reply on Dec 28, 2013 10:27 PM by keywords

    Scriptmaker

    hafiz5198

      How can I create a script so that when the script performs, all fields in the layout will automatically turn unmodifiable. Then if I want to modify the contents, I must maybe perform another script or something like 'Are you sure you want to modify......?'

        • 1. Re: Scriptmaker
          BowdenData

          Hi,

           

          There are several ways of doing this. I think the best way would depend on how many layouts you want to have this behavior on and even if it is only a couple of layouts, how many fields are on the layout(s).

           

          One potential solution would be to have 2 layouts that are basically identical to each other except that one has all the fields set to now allow entry in browse mode and the other version would allow entry. You could switch between them using scripts, or script triggers.

           

          Another way would be to use script triggers on each field that could look at a flag/status field to determine if okay to allow the user to click into the field or not.

           

          I highly recommend that you read up on script triggers. If you are running FileMaker 13, the help page for this subject can be found at:

           

          https://fmhelp.filemaker.com/fmphelp_13/en/html/script_trigg.38.1.html#1028417

           

          Yet another way that might apply to your situation would be to use Record Level Access controls in the security settings. See the following web page:

           

          https://fmhelp.filemaker.com/fmphelp_13/en/html/passwords.14.20.html#1028570

           

          Hope this helps.

           

          Doug

          • 2. Re: Scriptmaker
            keywords

            Yet another way is to use field validation by calculation, where the calc defines the circumstances in which the field becomes uneditable. The weakness with script triggers or alternate layouts is that this only operates on the specific instances of the fields. If you need to prevent changes to the field contents wherever the field is accessed then either field validation or record level access is a better method as it will operate on the affected fields wherever they appear.

            1 of 1 people found this helpful
            • 3. Re: Scriptmaker
              BowdenData

              My memory of this is fuzzy, but I recall that a field validation by calc won't fire until the user has made changes and attempts to exit the field, so that might not be optimal in this case. Good point about triggers and special layouts only applying the logic on specific layouts and not system-wide. The original poster should consider this.

               

              Doug

              • 4. Re: Scriptmaker
                keywords

                You are right about the way validation works, but it can be set to disallow override so that it will not allow the data to be changed.