4 Replies Latest reply on Mar 15, 2012 3:50 PM by davec

    Entering a checkbox without modifying it?



      Entering a checkbox without modifying it?



      I want to notify a user if they are making changes to a record. I thought a script trigger (on field entry) would be the way to go. However, checkboxes seem to disobey this rule as they change when clicked... is there any way to notify a user when they click on a checkbox without making the field change?



        • 1. Re: Entering a checkbox without modifying it?

          Capture the original value of the field by passing the value as a script parameter to you OnObjectEnter script.

          You can then use:

          Set Field [Yourtable::YourcheckboxField ; get ( Scriptparameter ) ]

          to revert the value of the field to keep it from changing on the first click or to ask for confirmation and then roll it back if the user decides against the change.

          • 2. Re: Entering a checkbox without modifying it?

            Thanks so much for the help! I like that but there are two things that don't seem to work for me:

            1) Other fields don't have the same behaviour and so don't set

            2) The script loops a few times for some reason - does "Set Field[]" trigger the "Enterfield" function?


            My script is:

            if[ locked=1]

                #do nothing


                Show custom Dialog["Error"; "You have locked record. Do you really want to change it?"]

                if[lastMsgChoice = 2]







            What am I missing?


            • 3. Re: Entering a checkbox without modifying it?

              1) describe the other fields are they check box fields? If not, you need to use either a different script or you need to pass an additional value inside the parameter that tells the script the format specified for the field. (This method also works for pop up menus.)

              2) Set Field does not trip any script triggers. Go to Object might--depending on what it goes to as that step puts the focus on whatever layout object has that name--which can trip an OnObjectExit trigger on the current field and an OnObjectEnter tirgger on the named object. If you have fileMaker advanced, you might want to test this script with the debugger and data viewer enabled so that you can watch things execute step by step to see if you can figure out why it appears to "loop a few times".

              • 4. Re: Entering a checkbox without modifying it?

                The other fields are text boxes. I could pass more parameters in to solve it but was hoping to get away with a "cleaner" solution. Oh well!

                Even without the gotoobject it still repeats... I'll debug it and see - great idea!

                Thanks so much Phil - you are great!