Wednesday, 10 February 2016

How to select items pre-default in Multiselection List Box in Infopath

Dear Friends,

Very useful blog.....

We had a requirement, where we need to have set of value default selected in Multi select List Box in Info path form.

Let see how to do the same..

STEPS INVOLVED:
  1. In InfoPath Designer 2010, create a new Blank Form template.
  2. On the Home tab in the Controls group, click Multiple-Selection List Box to add the control to the InfoPath form template.
  3. Follow steps 2 through 5 of the article to create an InfoPath XML data connection to an XML file in InfoPath 2010 to add a data connection to an XML file to the InfoPath form template.
  4. Click on the Multiple-Selection List Box to select it.
  5. On the Properties tab under the Properties group, click Control Properties.
  6. On the Multiple-Section List Box Properties dialog box under the List box choices, select the Get choices from an external data source radio button.
  7. The data source you created previously should be automatically selected in the Data source drop-down list box. If not, select it from the Data source drop-down list box.
  8. Click the button behind the Entries text box.
  9. On the Select a Field or Group dialog box, select a repeating group, and click OK.
  10. On the Multiple-Section List Box Properties dialog box, select appropriate fields for the Value and Display name, and then click OK.
In the example in this article, the list box will contain the names of running shoe brands such as Mizuno, ASICS, Brooks, Saucony, and New Balance.
To display a few items (for example, Mizuno and Saucony) pre-selected when the InfoPath form opens:
  1. On the Data tab under the Form Data group, click Default Values.
  2. On the Edit Default Values dialog box, expand group1.
  3. Click field1, and then type one of the values that you want to pre-select in the Default value text box. In our example, we'll type Mizuno.
  4. Right-click on field1, and then select Add another field1 below from the context menu that appears.
  5. Type the second value that you want to pre-select in the Default value text box. In our example, we'll type Saucony
  6. Continue adding as many field1 nodes as you require for pre-selecting values in the Multiple-Selection List Box. Click OK when you're done.
Press F5 to preview the InfoPath form. The items pertaining to the values that you entered as Default Values should now appear selected in the Multiple-Selection List Box when the forms opens.
This solution also works with the 2 other list box choices, that is, Enter choices manually and Get choices from fields in this form. This solution is independent of the data source you choose to use, but it is recommended that any Default Values you specify exist in the data source that is bound to the InfoPath Multiple-Selection List Box

No comments:

Post a Comment