4 Replies Latest reply on Apr 30, 2012 8:05 AM by cgildenhuys

    Change background image based on radiobutton values in a better way?

    cgildenhuys

      Title

      Change background image based on radiobutton values in a better way?

      Post

      I've got a layout with a radiobutton value list and based on the radiobutton clicked I change the image(backgroundcolor) in another field on my layout. These images are in a different table with only two fields, name of the color and container with the jpg. The two tables are linked based on the imageName field and the radiobutton value field and it works fine.

      My problem is that I don't want to name my radiobutton values the same as the imageName values for this to work. I would like to possibly use these images for other value lists too, the radiobuttons' values that display need to be named more precisely for the info I'm trying to collect whereas the imageNames need to stay "red", "blue", ect. I don't want my radiobutton to also say Red or Blue and so on.

      Is it possible to use the radiobutton values that I want and then use a calculation to set that value to the imageName needed for the correct image to come up? If so what would be the steps?

      Thanks

        • 1. Re: Change background image based on radiobutton values in a better way?
          Sorbsbuster

          Is that you have a relationship that works, and on the right side are records with data values like 'WhiterShadeOfPale', 'FortyShadesOfGreen', and 'SimplyRed', and currently on the left side is a radio button with the value list:

          WhiterShadeOfPale
          FortyShadesOfGreen
          SimplyRed

          and it works?  But you want the radio button to have a value list of:

          White
          Green
          Red

          and it will still work?

          If I have understood your question correctly, then why not displace the LHS relationship field to be a calculation, based on the new radio button value list?  The calculation for this NewValueToMatch would be:

          Case (

          RadioButton = "White" ;  "WhiterShadeOfPale" ;

          RadioButton = "Green" ;  "FortyShadesOfGreen" ;

          RadioButton = "Red" ;  "SimplyRed" ;

          "NoIdeaWhatThisShadeIs"

          )

          • 2. Re: Change background image based on radiobutton values in a better way?
            cgildenhuys

            Yes, that's exactly what I want.

            I'm trying it out now but having problems.... I'm fairly new to FMP so not too familiar with the terminology like LHS relationship. Where do I add this calculation? To the field that uses the radiobuttons I would assume? And I keep my link between the two tables as is?

            When I add it to my field where I'm using the radiobuttons, set to calculation with result as text but when I try it out I get "This action can not be performed because the field is not modifiable".

            • 3. Re: Change background image based on radiobutton values in a better way?
              Sorbsbuster

              Make another field with the calculation I've shown.

              Your existing relationship is using the 'old' (existing) radio button field and values on the Left Hand Side of its definition.

              Having created the new calculated field, change the value list for the 'old' radio buton field, and change the existing relationship to use the new field on its left hand side, not the current field.

              You will not be able to change the 'new' field (you don't even have to have it on a layout) as it is a calculation, but you will still be able to change the existing field.

              • 4. Re: Change background image based on radiobutton values in a better way?
                cgildenhuys

                Thanks so much. That worked perfectly.