5 Replies Latest reply on Mar 21, 2011 9:49 AM by philmodjunk

    Help with a radio button!



      Help with a radio button!


      Im using FileMAker10 windows7.  

      I have a radio button and my display values are "Male" and "Female".    When I click on Male, I want a set of fields to come up like (Coat, Neck, Sleeve, Waist and Inseam).  When I click on Women, I want a different set of fields to come up like (Bust, Waist, Hips, Dress).  Can anyone help me.   I have no idea how to write a script.  Thanks

        • 1. Re: Help with a radio button!

          There are several "visibility tricks" you can use to make portions of your layout appear or disappear in response to user actions. Most require some degree of scripting, However.

          1. Enter Layout Mode
          2. Place a tab control on your layout.
          3. Give it two tabs: Male and Female.
          4. Put the the Coat, Neck, Sleeve, Waist etc. fields on the Male tab and put the others on the Female tab.
          5. Select the Male tab in the tab control and type in "Male" without the quotes into the Name box at the top of the Inspector on the Data tab.
          6. Now select the Female tab and follow the same steps to name it "Female".
          7. Now we can write a short script that uses the value of your radio button field to select the matching Tab in the tab control

            Go To Object [YourTable::RadioButtonField]

            That's it, just the one script step, you'll need to subsitute the name of your table and the name of your field for what I've used there. To created it, select Manage | Scripts, click the New button, give your script a name and double click the go to object script step after you find it in the left hand list of steps. Then click the Specify button at lower right to open the options dialog, then click the upper specify button to bring up the specify calculation dialog. Find your radio field at the top and double click it to add it to the calculation. Finally close all these dialogs by clicking OK until you get back to the script editor. Close that window by clicking the window close control and save your changes when asked.
          8. Now right click your radio button field and select script triggers from the pop up menu. Select the OnObjectModify trigger and select your new script to run when this field is modified.
          9. Now return to browse mode and test this out by clicking the male and female radio buttons.
          10. Once you are sure it works, you can return to layout mode, select Layout setup... , select the script triggers tab and specify that OnRecordLoad also runs this same script.
          11. Finally, when you are sure you've got everything working, you can enter layout mode and specify fill and border colors or patterns for the tab control to make the tab control invisible.


          Other visibility tricks can be found here:  How to invisible a button

          • 2. Re: Help with a radio button!

            Thank you for your help.  Can you clarify the part where u say I will need to substitute the name of my table.

            When I do your steps the script reads        Go to Object [Object Name: ContactManagement:: Male Female]

            Is that right?

            • 3. Re: Help with a radio button!

              Looks right if Male Female is the name of your field and when you check Show Records From in Layout setup..., you see ContactManagement.

              • 4. Re: Help with a radio button!

                Hey thanks for your help with the radio button.  I have another question for u...

                I have 2 containers for pictures and i want to be able to swap the pictures with the click of a button.  Do you know what the script would be for that?

                • 5. Re: Help with a radio button!

                  The basic swap method (used for many decades in numerous programs) is to use a third location for temporary storage.

                  If these were just number or text fields, I'd use this code:

                  Set variable [$Temp ; YourTable::field1 ]
                  Set Field [YourTable::field1 ; YourTable::Field2]
                  Set Field [YourTable::Field2 ; $Temp]

                  I'm pretty sure that will also work with container fields, but try it to be sure. If it doesn't, define a global container field and use it with Set Field in place of $Temp with set variable.