In This Article:

    Show custom fields when an optional group is checked

    In This Article:

      Background

      A client came to us and asked if there were a way to allow a supporter to choose from a list of custom fields if an optional group was checked.  For example, if the supporter clicked on the Cheese optional group here:

      2015-08-26_1728.png

      Then the supporter would be prompted with cheese-related custom fields, like this:

      2015-08-26_1729.png

      Cool, huh?  All of the custom fields that are specific to a particular group are hidden until the supporter chooses to choice the group.  Like that?  Read on!

      Solution

      The solution is to add and configure a script that moves the custom fields below the associated group.

      Before you begin

      The installation has a more-or-less Javascript installation step and a configuration step.  Before you begin the installation, you'll need to make a list of optional groups and the custom fields that go with them.  For example, I used the Cheese group which has a groups_KEY of 93072.  The options groups that go with this group are the cheese optional groups in my Salsa HQ.

      2015-08-26_1738.png

      With these items in hand, I created a single group matching that looked like this:

      group 97032 contains API names cheddar, danisfarmcheese, gouda, longhorn

      If there were more optional groups that needed to have extra fields, then we'd repeat that step until they were all configured.

      Okay, configuration is done, let's go install stuff!

      Installation

      You can use these steps to install the script:  You'll need to install this script in all of the templates where groups are going to be associated with custom content fields.

      1. Edit the template.
      2. Locate the </body> tag by using the browser's search tool.
      3. Insert a blank line just before the </body> tag.
      4. Click here to see the solution.
      5. When the window opens, click on the Raw button.  That will open another window that contains only the solution text.
      6. Copy the solution text and close the window.
      7. Paste the copied text into the newly inserted line in the template.

      Okay, installation is done.  Now to configure the groups.

      Configuration

      This section shows how to configure the data used by the script.  The data is housed in some hidden HTML that appears just after the script.  Remember when we did the data gathering at the top?  This is where it will be applied.

      Please use these steps for each group that you collected.

      1. Locate the "Configuration" section at the bottom of the newly pasted text.

      2015-08-26_1757.png

       

      Was this article helpful?
      0 out of 0 found this helpful
      Have more questions? Submit a request

      Comments

      0 comments

      Please sign in to leave a comment.