2 Replies Latest reply on Mar 17, 2014 7:13 AM by philmodjunk

    Master Switch to Lock All Fields



      Master Switch to Lock All Fields


           In the Options portion of Field creation, there is a check box by "Prohibit Modification of Value During Data Entry" that will then lock the field so that a user cannot modify the data that is being viewed or, in my case, I use to to prevent me from accidentally modifying data.

           So I use this button to lock fields in so that I do not accidentally modify the values. But when I do want to modify the data in the fields, i need to go to that field, select each one, go to Options, Un-Check the box close up, and then I can make my modifications. I will then go back and Re-Check all the fields to once again lock them.

           This is a pain, so I would like to know if there is a way to make a Master Button that I can push that will Lock and Unlock all fields directly from the layout that I am viewing. I would then put this button off to the side, conditionally format it so that I can clearly see when Locked and when Unlocked. This way I could save much time and also prevent accidental change. 

           Can anyone help with a way to create this Master Field Lock script / button?


           Any help here would be greatly  appreciated.
           I have FMPro Advanced 12.0 v4
           OS - Windows Vista on desktop, Windows 7 on laptop



        • 1. Re: Master Switch to Lock All Fields

               I'm sure others can chime in on the many ways to do this.  But simplest solution for me (only user), was to make another identical layout of almost all merge fields in place of all the data fields.  On the layout I have an 'Edit' button which is just a Go to Layout step.  That button takes me to the 'Data Entry Layout' where I can change info.  When the record is committed, I have a trigger that uses the Go to Layout step to take me back to the original layout.

          • 2. Re: Master Switch to Lock All Fields

                 If you want to set a value in a field to lock them you can use a validation field option with the calculation option:

                 IsEmpty ( LockField )

                 If lockField is defined in the same table as the fields where you add this lock expression, setting any value in this field will cause a validation error message to pop up for any field that is defined with this field option in the same record.

                 If you want to lock the fields for every record in your table, make LockField a global field or global variable and then setting a single value will lock the fields for all records in the table.

                 Note: With this option set, you can still enter and modify data, but you'll get an error message and a button that can revert the change when you exit the field. That should be sufficient to prevent accidents, but there are other options you can set up that allow you to provide your own more user friendly layout or that selectively prevent a user from entering a field through the use of script triggers.