While InfoPath does not include a multi-select list box control, it is possible to create one using the controls present in InfoPath SP1 Preview:
Like all form design decisions in InfoPath, the first thing you need to do is think about the data you want to collect – how do you want the multiple selections represented in the XML saved or submitted by the InfoPath form? Additionally, do you want the selections to be determined at form design time (static), or at runtime (dynamic)?
Here’s one approach that allows either a static or dynamic list of choices by including the choices – and the selection state – right in the form data.
First, create a data structure as follows:
Here are the steps to do this:
Note that if you want a very different data structure the rest of these instructions won’t apply directly, but they should get you started down the right path in terms of understanding how to create a complex control out of the primitives that InfoPath provides.
Now you need to build the view – here’s what I came up with, showing the design-time structure:
This is a Scrolling Region as the outer container for the control, containing a Repeating Table for the options, with a Check Box and Expression Box for each option. Here’s how you make it:
Next, tweak the layout and borders to make it look professional:
Finally, if you want to make the selected options stand out clearly, you can use Conditional Formatting:
At this point, the Multi-Select List Box control is ready to go – but it doesn’t have any options! Maybe those options are specified by your form’s back end data source (a database or web service). But for now, let’s assume the list is static:
That’s it! Now just hit the Preview button on the toolbar to try our your new Multi-Select List Box control.
Note: You can also create ActiveX controls that do XML data binding with the InfoPath SP1 Preview.
Nice Blog, But I have 1 problem.
How can we know that which check boxes are selected on submitting of form?