4 Replies Latest reply on Apr 30, 2012 3:50 PM by FernandoAlves

    Using checkboxes and/or radio buttons in a "portal context"

    FernandoAlves

      Title

      Using checkboxes and/or radio buttons in a "portal context"

      Post

      Hello everyone,

      I'd like to be able to use a checkbox or radio button set to specify a "default" entry in a portal.

      For example, I have a membership database, and in a member record, I show a portal of his/her addresses. Since each member can have multiple addresses, I'd like the user to check a box/radio button to specify which of the addresses shown in the portal is the default address for that member. Easy enough to add a checkbox field... However, I'd like this checkbox to act like radio button sets, where you can only have one checked at a time. The problem is that the context of a radio button set is a record and I want it to be the portal, so I can have one checkbox per record and have them automatically clear if I select a different record in that portal.

      Any ideas?

      Thanks for any help,

      Fernando

        • 1. Re: Using checkboxes and/or radio buttons in a "portal context"
          philmodjunk

          I am assuming that you have this relationship:

          Members::MemberID = Addresses::MemberID

          If you have a different relationship--such as using a join table so that many members can link to the same address record, let me know.

          Define a serial number field to uniquely identify each address record: AddressID. For existing records in this table, you will need to use Replace Field Contents to give them serial numbers.

          Define a field in your Members table as: PreferredAddressID.

          Use layout tools to draw a square in the row of your portal.

          Use the layout text tool to add the letter x,  sized and formatted to fit the center of the square.

          Use this conditional format expression:

          Members::PreferredAddressID  ≠ Addresses::AddressID

          To specify a font size of 500 to make the X disappear for all but the address selected as a preferred address.

          Write this script:

          Set Field [Members::PreferredAddressID ; addresses::AddressID ]

          (I don't recall if its needed, but you may need to add a second step: Refresh window [] after the set field step.)

          Now use button set up to turn the Letter X into a button that perfroms the above script.

          When you click the center of the square, the script will update the PreferredAddressID field and the conditional format on the letter will update to display the X to show a selected check box. (You can group the box and Letter X before using button setup if you want to turn both into a button or you can use other symbol text--such as a tick mark in place of the box and x set up described here.)

          You can also create a new occurrence of your address table and link it to your Members table with this relationship:

          Members::PreferredAddressID = PreferredAddress::AddressID

          If you find you need that relationship in your database system.

          • 2. Re: Using checkboxes and/or radio buttons in a "portal context"
            FernandoAlves

            Perfect! Works great! Thanks.

            Besides field names, of course, I changed the font color instead of size to make it visible/invisible. Still works great.

            -F

            • 3. Re: Using checkboxes and/or radio buttons in a "portal context"
              philmodjunk

              I recommend changing the font size. With that set up, you don't have to update the conditional format expression should you decide to change the layout background color at some point in the future.