locked
How do I create a "sub-drop-down" menu? RRS feed

  • Question

  • Within one of the forms that I have been working designing, I have a drop down menu with about 8 choices. Each of these choices are "brands". Some of these "brands" will have "sub-brands". I was wondering if there is a way in InfoPath that I can create a drop-down menu, that when the user selects the initial "brand" it branches off into sub-brands that they can select.

    OR...

    I have one drop-down that contains the "main brand" then have another drop-down that contains all "sub-brands" The "sub-brand" drop-down will have nothing in it to select until the user selects a "main brand" from the "main brand" drop-down. When the user selects the main brand, the "sub-brand" drop-down will be populated with all "sub-brands" relative to the "main brand"

    Example:

    Main brand drop-down:
    Brand1
    Brand2
    Brand3
    Brand4

    Sub-brand drop-down (not populated until "main brand" is selected):
    Sub-brand1
    Sub-brand2
    Sub-brand3
    Sub-brand4
    Sub-brand5
    Sub-brand6
    Sub-brand7

    *User selects brand1, sub-brand is populated with sub-brand1 & sub-brand2*
    *User selects brand2, sub-brand is populated with sub-brand3*
    *User selects brand3, sub-brand is populated with sub-brand4*
    *User selects brand4, sub-brand is populated with sub-brand5, sub-brand6, & sub-brand7*

    Please tell me that this can be done and done easily. :) J/k... just let me know if it's possible period.

    Thank you for your help in advance.

    • Edited by SP Brian Friday, May 29, 2009 3:02 PM
    Friday, May 29, 2009 3:00 PM

Answers

  • Is this a rich-client form?  if so, then just use filtering on the 2nd dropdown to limit the choices to those that are associated with the selection of the 1st dropdown.  Your initial data set would need to look like this:

    Sub-Brand1 | Brand1
    Sub-Brand2 | Brand2
    Sub-Brand3 | Brand3
    Sub-Brand4 | Brand4
    Sub-Brand5 | Brand4
    Sub-Brand6 | Brand4

    The first dropdown would be populated with the second column of that data source (check the box to show unique values only).  The 2nd dropdown would be populated with the first column of that data source.  Then, the 2nd dropdown would also have a filter that says to only show items where Brand# = the value of dropdown1.

    This is not supported in browser-enabled forms.
    SharePoint Architect - Planet Technologies - 4-Year Microsoft Federal Partner of the Year (2005-2008)
    • Marked as answer by SP Brian Friday, May 29, 2009 5:21 PM
    Friday, May 29, 2009 3:23 PM
  • Yeah, something simple like a SharePoint list (custom list) that has 2 columns - one for all sub-brands and another for the brand associated with each sub-brand.  Since there will be more sub-brands than brands, I recommend making sub-brand your primary key and then just make "brand" another piece of metadata (column) for the sub-brand record.  That way, when you make your data connection to that list, it will be very easy to do the filtering inside InfoPath, since each sub-brand is related to a single brand.
    SharePoint Architect - Planet Technologies - 4-Year Microsoft Federal Partner of the Year (2005-2008)
    • Marked as answer by SP Brian Friday, May 29, 2009 5:21 PM
    Friday, May 29, 2009 4:30 PM
    1. On the second dropdown control, go to the properties
    2. Click on the Select XPath button to the right of the Entries box
    3. Click Filter Data
    4. Add
    5. Select your Brand element (the field that the first dropdown is bound to)
    6. Is Equal to
    7. Select Field or Group > Switch to Secondary data source showing the brands and sub-brands > Select the Brand node

    SharePoint Architect - Planet Technologies - 4-Year Microsoft Federal Partner of the Year (2005-2008)
    • Marked as answer by SP Brian Monday, June 1, 2009 8:21 PM
    Monday, June 1, 2009 7:39 PM

All replies

  • Is this a rich-client form?  if so, then just use filtering on the 2nd dropdown to limit the choices to those that are associated with the selection of the 1st dropdown.  Your initial data set would need to look like this:

    Sub-Brand1 | Brand1
    Sub-Brand2 | Brand2
    Sub-Brand3 | Brand3
    Sub-Brand4 | Brand4
    Sub-Brand5 | Brand4
    Sub-Brand6 | Brand4

    The first dropdown would be populated with the second column of that data source (check the box to show unique values only).  The 2nd dropdown would be populated with the first column of that data source.  Then, the 2nd dropdown would also have a filter that says to only show items where Brand# = the value of dropdown1.

    This is not supported in browser-enabled forms.
    SharePoint Architect - Planet Technologies - 4-Year Microsoft Federal Partner of the Year (2005-2008)
    • Marked as answer by SP Brian Friday, May 29, 2009 5:21 PM
    Friday, May 29, 2009 3:23 PM
  • This will be used inside the application itself, not browser-enabled.

    What do you mean by data set? Is this a table with the information of brands/sub-brands? How do I reference/link multiple sub-brands to one main brand?
    • Edited by SP Brian Friday, May 29, 2009 5:23 PM
    Friday, May 29, 2009 4:02 PM
  • Yeah, something simple like a SharePoint list (custom list) that has 2 columns - one for all sub-brands and another for the brand associated with each sub-brand.  Since there will be more sub-brands than brands, I recommend making sub-brand your primary key and then just make "brand" another piece of metadata (column) for the sub-brand record.  That way, when you make your data connection to that list, it will be very easy to do the filtering inside InfoPath, since each sub-brand is related to a single brand.
    SharePoint Architect - Planet Technologies - 4-Year Microsoft Federal Partner of the Year (2005-2008)
    • Marked as answer by SP Brian Friday, May 29, 2009 5:21 PM
    Friday, May 29, 2009 4:30 PM
  • That makes very much sense. I would have to agree with your suggestion on the sub-brand being the PK. It makes most sense that way. I think I can figure that out, but not before my 2:00 EST live meeting though where I am demoing the form :) I am eating lunch right now.. no more time for form template editing =]
    Friday, May 29, 2009 5:20 PM
  • I finally got around to trying to do this. This is what I have (sub-brand and brand are different columns in the same SP list):

    Sub-brand     |     Brand    
    Sub1             | Brand1
    Sub2             | Brand1
    Sub3             | Brand1
    Sub4             | Brand2
    Sub5             | Brand2

    I have two drop-downs in my template, the first with the field name "brand" gets it's information from the "brand" column of the list, the second drop-down with the field name "subbrand" gets it's information from the "sub-brand" column of the list. I can't figure out the filtering that you were talking about. I am wondering if I have the list setup like I am supposed to.

    Monday, June 1, 2009 7:31 PM
    1. On the second dropdown control, go to the properties
    2. Click on the Select XPath button to the right of the Entries box
    3. Click Filter Data
    4. Add
    5. Select your Brand element (the field that the first dropdown is bound to)
    6. Is Equal to
    7. Select Field or Group > Switch to Secondary data source showing the brands and sub-brands > Select the Brand node

    SharePoint Architect - Planet Technologies - 4-Year Microsoft Federal Partner of the Year (2005-2008)
    • Marked as answer by SP Brian Monday, June 1, 2009 8:21 PM
    Monday, June 1, 2009 7:39 PM
  • Took a while to get it, but I got it. Wow. For step 5, I wasn't selecting the element the actual form template, I was selecting the field from the list... I am such a noob. Thank you very much.

    Monday, June 1, 2009 8:21 PM