7 Replies Latest reply on Jul 1, 2016 3:42 PM by robert@karpinos.com

    Scripting with yes, no check box

    robert@karpinos.com

      Hi- I am trying to make a simple script where IF the answer to condition 1 is "YES", the script will fill the next fields result.  else ( "NO") the script moves to the next question.

      the script works fine with edit box entry. but not when I define the answer to condition 1 with a Yes No check box.... how can this be done?

        • 1. Re: Scripting with yes, no check box
          Extensitech

          Put a version of your checkbox field on the layout as an edit box, and make sure that the "yes" or "no" from the value list doesn't have added spaces or something.

           

          Also, if this is checkboxes, you could check both yes and no, which wouldn't match "Yes" or "No". A radio button may be more appropriate here?

           

          Finally, if you're trying to trigger this with an onSave trigger, you may be running into the issue where clicking a checkbox triggers onModify, rather than onSave.

           

          Could it be one of these things? If not, we may need more info.

           

          HTH

          Chris  Cain

          Extensitech

          • 2. Re: Scripting with yes, no check box
            PeterDoern

            Also, if this is checkboxes, you could check both yes and no, which wouldn't match "Yes" or "No". A radio button may be more appropriate here?

             

            Just my 2¢: Only because I prefer the look of checkboxes to radio buttons, I like to set auto-enter calculation of these sorts of fields to GetValue ( self ; 2 ) which nicely emulates radio button behaviour.

            • 3. Re: Scripting with yes, no check box
              taylorsharpe

              I prefer to use Boolean where 1 is Yes and Blank or 0 is No.  You can define a number field in the Inspector to display Yes or No based on the Boolean value.  But I also think check boxes and radio dialogues in FileMaker look so 1990's and is really tacky.  So I create my own check box buttons that are graphics.  One for on (Yes) and one for off (No) and use the hide function to hide the one not corresponding to the value in the field.  And I make the graphic a button that toggles the value between 1 and empty.  Actually, lately I have been using the buttons with SVG icon instead of just a graphic because I like having hoover states, etc.  All which can make it look a little better.  Another reason to use 1 and 0 for Yes and No is if this ever has to be multi-lingual, Boolean is better than using English words. 

              • 4. Re: Scripting with yes, no check box
                BruceRobertson

                Really?

                GetValue ( self ; 2 )

                When would that ever work?

                Perhaps you mean GetValue ( self ; 1 ) ?

                • 5. Re: Scripting with yes, no check box
                  PeterDoern

                  Fields formatted with checkbox value lists store the values in a carriage return delimited list in the order in which the checkboxes are checked. After the first checkbox is selected, any subsequent checkbox will be value 2 in the field. By swapping out the field contents with GetValue ( self ; 2 ) you are always setting the field to the last checked value.

                   

                  EDIT: facepalm moment! Sorry, auto calc formula should be GetValue ( Self ; ValueCount ( Self ) ) -- otherwise first value would never register. Sorry folks!!!

                  • 6. Re: Scripting with yes, no check box
                    Stigge

                    This is not pritty, but simple and works =D

                    • 7. Re: Scripting with yes, no check box
                      robert@karpinos.com

                      thank you- the script works when the data is an edit box and the word value list "yes"or"no" is inserted

                      but it does not work when the data is a check box with the value list "yes""no"