6 Replies Latest reply on Dec 9, 2014 4:52 PM by MarkGores

    locking checkbox fields



      locking checkbox fields


      I have a form that I can't lock using the security permissions because it is a two part form with 2 signature fields and I want to lock part 1 and still be able to access part 2.  On most of the fields I have a script that commits the record on field entry if signature1 is not empty, but can still change the checkbox fields eventhough I set the script trigger on those.  Maybe because filemaker is not recognizing this as entering the field (just like clicking a button does not make it the active object)?  Is there a way to prevent editing these fields based on the status of the signature field?

        • 1. Re: locking checkbox fields

          OnObjectEnter is triggered, but only after the field is modified. I'd use OnObjectModify for this field and pass the original value of the field to the script by putting the field's reference into the trigger's optional parameter box.

          You can also set up a validation field option that rejects changes to the field via a calculation that references the lock field, but this lets the user change field field and then makes them revert it. However, it's a change at the data level rather than the layout level so it can be useful to add as a "back up" to the layout level script triggers.

          • 2. Re: locking checkbox fields

            (BTW am using FM11 adv)

            I must be doing something wrong, the validation thing isn't working.  I did make a slight change to the script and have it set to both on enter and on modify, and that seems to work.

            If(not Is Empty (Get (LayoutTableName::signature)

               Revert Record/Request[No dialog]

              Commit Record/Request[No dialog]


               Exit script

            End If

            • 3. Re: locking checkbox fields

              Your calculated validation rule would be:

              IsEmpty ( LockfieldReferenceHere )

              Haven't tried this with a check box formatted field but see no reason why it wouldn't work.

              • 4. Re: locking checkbox fields

                I just tried that and if I remove the script trigger lock I now get an error message that says the field is only allowed to contain certain values and won't let the user out of the field unless they revert.

                • 5. Re: locking checkbox fields

                  Exactly what a validation rule would do. It does not prevent the attempt to change the field. It catches the error after the fact and makes the user revert. That's why I use layout design means to prevent this, but leave the validation just in case I make a mistake and a user finds a way around my layout design based barriers to changing the field.

                  There is another way in FileMaker 13. You can stack two copies of the field on top of each other. Set each with opposing "hide object when" expressions. Use field behavior to deny browse mode access to one of the two fields. Then setting the "lock" field hides the unlocked copy and reveals the locked copy.

                  • 6. Re: locking checkbox fields

                    Great.  Now I really want 13.