4 Replies Latest reply on Mar 29, 2012 2:38 PM by tracylynn1212

    Image/picture to show only when checkbox is selected

    tracylynn1212

      Title

      Image/picture to show only when checkbox is selected

      Post

      Hello,

      I have two identical layouts - one Read-Only and one for Editing. I have a field called "notice" that will contain any important information the user needs to see. Next to it there is a check box that when checked, simply indicates this is an important issue that needs immediate attention. I want to create something where when the user is in the Edit layout and checks the checkbox next to the Notice box, a picture (such as a warning icon let's say) will appear on the Read-only screen indicating the notice box is important.

      Is there a way to do this?

        • 1. Re: Image/picture to show only when checkbox is selected
          philmodjunk

          There are a number of ways you can do it. Here's a simple, non-scripted approach.

          Define a global container field, named WarningIcon. Insert your graphic into this global field.

          Define a calculation field with this expression:

          If ( Not IsEmpty ( checkBoxField ) ; WarningIcon )

          Select "container" as the calculation's return type.

          Put this calculation field on your layout and set up the check box field's value list with a single value.

          When you click the checkbox the image inserted into WarningIcon will appear.

          • 2. Re: Image/picture to show only when checkbox is selected
            tracylynn1212

            Hi Phil,

            This looks SOOO easy, yet I am not getting it to work.

            Here are my fields:

            "Warning Icon" - set as Container type with Global storage. No calculations applied.

            "Needs Attention" - set as Calculation type. In the options screen, the "calculation result is.." is set to Container. The calculation applied is If ( not IsEmpty ( Needs Attention: ) ; Warning Icon )

            I added the Warning Icon field to the layout and then I drag and dropped my graphic onto the Warning Icon container field (which confused me because it doesn't seem to stay in there for when I move the container field, the icon stays in the same spot as if it was only sitting on top of it, not really applied to it.)

            I added the Needs Attention field to the layout (which looks like a Container). However, I cannot select any data properties in the Inspector window to change the control style of that field to a checkbox. It's greyed out on Edit box.

            What am I missing. :o(

             

            • 3. Re: Image/picture to show only when checkbox is selected
              philmodjunk

              It is staying on top and is not actually inserted into the container field.

              In layout mode, you would copy the icon to the clipboard, enter browse mode, click into the Warning Icon container and then paste the copied image.

              You need three fields, not two:

              A global container field, a check box field, and a calculation field that uses the value of the checkbox field to determine whether to return the contents of the glogal container field or null (nothing).

              But you need a field of type text or type number that can be formatted as your checkbox field.

              Then your calculation would be: If ( not IsEmpty ( CheckBoxField ) ; Warning Icon ) )

              If you specify  a checkboxfield of type number and specify 1 as the single value in its value list, you can resize the check box field to hide the number 1 from view and simplify the above calculation to be:

              If ( CheckBoxField ; Warning Icon ) )

              • 4. Re: Image/picture to show only when checkbox is selected
                tracylynn1212

                THANK YOU THANK YOU THANK YOU! It worked!

                I am sure I will be reaching out again as I am only 10 days into using FMP 11.