8 Replies Latest reply on Nov 15, 2015 1:38 PM by Appogee

    Prevent user from changing a Checkbox?

    Appogee

      Hello everyone.  I'm new to Filemaker and trialling v14.  Over the past week my skills have improved significantly thanks to the many useful discussions in this community and its predecessor.

       

      But I've come up against a problem that I can't seem to solve...

       

      I have a single Checkbox which is set up as a Boolean button.   When this checkbox is clicked, I use the Button Action [TblMyInventory::Owned; not TblMyInventory::Owned] to toggle the value between zero and non-zero.   The data formatting for this Checkbox is set up so that non-zero is displayed as the character "☑" and zero is displayed as the character "☐".    In this way, the user sees a "blank ballot box" character, clicks it and sees a "ticked ballot box" character, clicks it again and sees a "blank ballot box" character, etc.

       

      I need a script which prevents users from clicking on and changing this checkbox.   The checkbox needs to remain visible - but not changeable.

       

      I tried using a script with the Script Trigger OnObjectEnter.  It should have moved the cursor to the next field.  However, while this script worked on standard fields, it would not work on this checkbox.  

       

      Can anyone help me to solve this?    Thanks in advance for your advice.

        • 1. Re: Prevent user from changing a Checkbox?
          MaxEh

          Sounds like the checkbox is just a visual clue regarding the current record. The simplest way is in the Inspector go to the Data tab and under Behaviour area in the Field entry section uncheck Browse Mode. This applies only to the checkbox field on the current layout. No script triggers etc.

           

          Martin

          • 2. Re: Prevent user from changing a Checkbox?
            coherentkris

            How do they set it the first time?

            Change implies setting it the first time.

            You cant let them click it and prevent them from clicking it at the same time.

            • 3. Re: Prevent user from changing a Checkbox?
              siplus

              maybe you want to be able to change the value by using your admin account but don't want normal users to be able to change it ?

               

              You have at least 2 options if that's the case, is it ?

              • 4. Re: Prevent user from changing a Checkbox?
                Appogee

                @MaxEh: The Check Box is more than just a visual clue to the current record.   Toggling it on and off does put a zero or a 1 in the corresponding field in the TblMyInventory database. 

                 

                It's a selection I do generally want the user to make.  I do want users to be able to toggle it on and off most of the time.

                 

                However, there is certain other question in this form which, if they selection one specific answer to, then I want this Checkbox to be locked to a specific value.  Put another way... if they select Option B in another field, then I want to set this Boolean Checkbox to a specific value and prevent the user from changing it.

                 

                (Incidentally, unchecking 'Browse Mode' in the Data tab didn't stop the checkbox from toggling between states, for some reason - seems odd.)  

                 

                Thanks though for your efforts to help me.

                • 5. Re: Prevent user from changing a Checkbox?
                  Appogee

                  @coherentkris They set if the first time (and unset it, and reset it) as many times as they like, by clicking it.

                   

                  However I want to lock it - ie prevent them from changing its state further - if they select a different value from a completely different field.  

                   

                  I can do all of the above if it's just a standard text field.  I can apply a script with the Script Trigger OnObjectEnter which forces the cursor to move to the next field, before they can change the current field.    This in effect stops the field from being further updated.


                  However, this script approach doesn't work with the Boolean Checkbox button, for some reason.


                  Thanks though for your suggestion.

                  • 6. Re: Prevent user from changing a Checkbox?
                    Appogee

                    @siplus This is a "one user" application.   So setting differentiated admin/user privileges won't solve my challenge, unfortunately.

                     

                    Thanks though for your suggestion.

                    • 7. Re: Prevent user from changing a Checkbox?
                      siplus

                      well just put a transparent rectangle over your checkbox and associate a script to it.

                       

                      In that script you can do whatever you want: check the value of other fields and exit the script if it's the case, check who the user is etc and also toggle the field value to be not(fieldvalue). End the script with a commit records/requests and you're happy.

                      • 8. Re: Prevent user from changing a Checkbox?
                        Appogee

                        siplus Thanks! I do believe that will work.

                         

                        Thanks again everyone for the help, I really appreciate it.

                         

                        EDIT: I realised another way of solving my problem...

                         

                        While I couldn't ever prevent the user from changing the Checkbox, I could make the Checkbox become invisible (and unclickable) via Make Object Invisible section of its data tab. 

                         

                        I put a text box behind the checkbox, displaying the value I wanted to display while the Checkbox was invisible.

                         

                        So: when the user is to be prevented from changing the Check box, the Checkbox becomes invisible, the text box behind it displays the locked value, and any clicks on that text box result in no change to the actual value of the Checkbox.    to the user, it looks like a locked Checkbox, even though the actual Checkbox was hidden.

                         

                        Two weird things I learned about Filemaker through this:

                         

                        1: Script Triggers don't seem to work on Boolean Checkboxes.

                        2. If I put a graphic box over the top of a checkbox, to hide the checkbox, users can still click on that graphic box and activate the Checkbox underneath it.

                         

                        Odd.