Monday, October 20, 2008

Make an InfoPath Multi-Select Control That Works In Forms Services And Apply Conditional Formatting to Another Control Based On A Particular Selection

Okay, that title is a mouthful, I know, but to me the way you do this kind of thing in InfoPath is not intuitive, and therefore worthy of a blog post. It’s actually quite easy to do once you’re informed, so I’ll skip the small talk and get to it.

First of all, the scenario. I was trying to give my users a multi-select list control even though I’m working in Forms Services within SharePoint, and then show some additional form controls based on particular selections made in the multi-select list.

As you know, the standard InfoPath multi-select control is not compatible with Forms Services (no, really, I’m serious – it’s not), and although there are some good posts out there on how to achieve the same basic effect using checkboxes ( ), that didn’t seem like a wise choice to me, since my option list contains more than 100 entries. Checkboxes would just take up too much screen real estate to be practical.

So, the answer for me in such a scenario is the Repeating Table control.

First, I create my Data Source structure (words to live by, btw) as follows:

Next, I drag the RepeatingTableOptions node over to my Design area and pick the Repeating Table option for control type.

Then, I drag “HideSection_Dependent Field” over to the Design area, and select “Section With Controls” as the control type.

For my purposes, I want a dropdown list box control in the repeating table instead of a textbox which InfoPath dropped in there by default, so I right-click the textbox, and select Change To Dropdown list box.

The dropdown list box control needs some data in it, so I put some values in there by right-clicking the drop-down list box control and clicking “Drop-Down list box properties…” In my real-world scenario with 100+ options, I use a SharePoint list to seed the dropdown, but for this example, we can just choose the “Enter list box entries manually” option. I click “Add” and add a list that includes “Dog,” “Goldfish” and “Hermit Crab.”

Next, I right-click the textbox control labeled “Dependent Field” and Change To Dropdown Listbox control. I right-click again and choose Drop-down List Box Properties. I add some manual entries here too, “Cockapoo”, “Labradoodle” and “Schnoodle.”

By now, you probably know where I’m going with the Dependent field... If the user selects “Dog” for the Repeating Field, I want the Dependent Field to become visible. Otherwise, it should remain hidden.

So, finally, I right-click on the Section containing the Dependent Field, and click “Conditional Formatting.” I create the single rule shown below, which basically says if the user’s selections do not include “Dog” then hide this “Dependent Field” section. You’ll notice right off (it took me a lot of trial and error, sniff sniff) that it’s not the Leaf node, nor the Options node, but in fact the Group we created one step above the Options list that is the one that is tested by the rule.

By the way, if you use Options or Leaf, at a quick glance, you might appear to have success, but you’ll find that it only tests the first row of the table in those scenarios, which misses the whole point. If the user selects “Dog” in the second row of the table, the dependent field needs to be able to recognize it just the same.

So there you have it.

You can preview the working example you just created in InfoPath, but since we’re really trying to work around the lack of multi-select list support in Forms Services, deploying it to a SharePoint site is going to be the real test.

Please drop me a note if you found this post helpful.


  1. Hey nice approach.

    It is believed that browser enabled InfoPath forms do not support multiple selection list box.

    But there is a work around for this.

    I have posted a step-by-step approach along with the source code to make multiple selection list box a possibility with browser enabled InfoPath forms.

    Read my full post at:

    The example here is for InfoPath 2007, but should work well with InfoPath 2003 as well, since it is a programming approach.


    The SharePoint Fix Team

  2. Thanks for the feedback and for sharing another approach to this problem, Mehul. My solution was intended for a power user who doesn't have programming skills or the ability to easily leverage IT, but if programming is an option, then your approach might make a lot of sense. Thanks again! -- Jeff


What do you think?