3 Replies Latest reply on Jul 21, 2013 10:50 AM by philmodjunk

    Any script to block or unblock a field in a layout?

    TaylorJansen

      Title

      Any script to block or unblock a field in a layout?

      Post

           I want some fields to be opened to the user upon certain situation. Any script for this? 

            

        • 1. Re: Any script to block or unblock a field in a layout?
          philmodjunk

               Do you want to block access to the field completely? (Can't copy from field as well as can't edit?)

               Or just prohibit the user from making changes?

               Either way, you can set a value to another field or possibly a global variable and then that field can be used to control access to the field.

               A validation calculation can reject all changes to a field if the variable or field is not empty. This prohibits changes after the fact, the user is permitted to access the field and change values, but then an error message pops up and rejects them. But, this allows you to set this up at the data level so that access is controlled on all the layouts where you might place this field.

               The OnObjectEnter script trigger can be set to check the value of that field or variable and if it is set to a specific value, uses go to next field, go to field or go to object to move the cursor back out of the field and puts the focus on the object specified by the script step. This prevents all access to the field, but for two exceptions: Drag and drop can still modify the contents of the field as this action does not trip the script trigger. Fields with pop up menus allow the user to select a value from the pop up value list before the trigger is tripped. Thus, you often need to set up both of these limitations to make sure you have all the loop holes plugged in your user interface.

               You may also be able to use Record Level Access control, this is the most secure method, but limits access to the entire record, not just a field or field defined in it. This may still work for you and sometimes developers make it work by splitting a table into two tables linked in a one to one relationship so that they can put all the fields for which they want to control access in one table and all other fields in the other.

               See "Editing record access privileges" in FileMaker Help and check out this particular sub section: "Entering a formula for limiting access on a record-by-record basis" for a description of how to set this up.

          • 2. Re: Any script to block or unblock a field in a layout?
            TaylorJansen
            I think what I'm asking is like an allow edit button. before the button is clicked, you can't change the record current record.
            • 3. Re: Any script to block or unblock a field in a layout?
              philmodjunk

                   Then your "allow edit" button can be used to perform a script that changes the value of a field or global variable that then controls edit access to the field. My previous post discusses several different ways that you can use the value in such a field or variable to control access.

                   In addition, you can script the edit button to open up a custom dialog with an input field or that uses New Window/Go to Layout to open up a new window that displays the field's value and permits editing that value. With that method, you can just use behavior settings to prohibit browse mode access to the field on the layout.