4 Replies Latest reply on Jul 11, 2009 10:41 AM by frog22

    Locking a field (promise this one is different from the others)

    frog22

      Title

      Locking a field (promise this one is different from the others)

      Post

        Using FMP 9 and I'm wanting to do a conditional formatting lock type of thing.  

       

      Givens:

          Table A

              Field "CheckBox"

              Field "Oh Yea"

       

      What I am trying to do is make it to where when field "CheckBox" is checked, then field "Oh Yea" is locked & unable to be edited.  But, if field "CheckBox" is unchecked, then field "Oh Yea" can be edited.

       

      BTW, you guys are awesome for reading & answering our questions.  Thanks!

       

      Kevin 

               

        • 1. Re: Locking a field (promise this one is different from the others)
          ninja
            

          Howdy frog22,

           

          Believe it or not, it is the same as the others...but I suppose it depends on which others...

           

          In accounts and privileges, set the field access privilige to "limited..."

          This will bring up a calculation box where you write in the conditions under which it can be edited.

           

          Set your calculation to:

                          Table1::Checkbox=""

           

          I'll grant you that its different from the other posts on the conditions under which the field can be edited, but at the end of the day, it's still a conditional privilege.  That's a good thing, keeping it simple.

          • 2. Re: Locking a field (promise this one is different from the others)
            frog22
               There is a minor issue with this.  I can lock the whole Table A using the privilege, but cannot find a way to lock & unlock a single field when Field "CheckBox" is checked.
            • 3. Re: Locking a field (promise this one is different from the others)
              ninja
                

              Howdy frog22,

               

              Whooops.  You are correct...I'm so used to handling it the same way that my brain took a shortcut...sorry.

               

              1. Copy the layout and call the copy something like "can enter value".

              2. Make the field enterable in browse mode on this layout.

               

              3. On the layout that you want the field locked, make the feild not enterable in browse mode, and make that field a button and attach a script to it.

              4. The script would be:

                    If [Checkboxfiled=""]

                        ***Add whatever action you want right here***

                        Exit Script

                   EndIf

                   GoToLayout ["can enter value"]

                   GoToField [field1]

              5. Set the Access Privileges calculation on the "can enter value" LAYOUT since you can't set it on the individual FIELD.

              6. Set the "can enter value" layout to not appear on the layout list.

               

              In this, when they try to enter a value to the field, it will actually switch them to a mirror layout and they can enter a value in the mirror layout.

               

              Things to consider along the way based on your preferences and your specific application:

              A) Think about using a custom dialog box for field entry in place of the "GoToLayout".  If you like this way, you won't need the mirror layout.

              B) If you use the mirror layout approach, consider what actions you want to take to tell people what's going on.  Custom dialog of "checkbox not checked" or something...?

              C) If you go to the mirror layout consider how to send them back to the "locked" layout.  If you leave them on "can enter value" layout...they can change other records too.  In FMP10 you can use script trigger return to the "can't enter" layout.

               

              A few different methods consider.  Others on the forum may comment on which they prefer and why, or add totally different approaches.  I tend to use the first one, primarily because it's the first "patch" I tried and it worked...no real other reason.

               

              • 4. Re: Locking a field (promise this one is different from the others)
                frog22
                   I'm on deployment & just got back online.  I was able to get things to work (mostly) through a back door user security measure.  I'm going to try this, though, because I would prefer an easier method.  I'll give this a shot & let you know.  Thanks again for the help!