List Form with Multiple Selection List Box

SharePoint 2010 has great possibility to implement simple InfoPath forms directly from the custom lists, without converting this lists to InfoPath Form libraries. Even this possibility has some limitations (e.g. no custom code behind form), it excellent option for simple forms, like cascaded fields or fields with filtered ranges.

InfoPath List Form  can also have a “Multi-Selection List Box”, which is also default control for a form, which has lookup field from other list. In my case I’m  filling this list with persons and my customer can select one or multiple persons who has specific role. This is relatively simple task: first you have to create a new Data Source from the persons list, than filter all elements by the role when presenting it into multiple selection list box control. So far so good. However, when you publish this simple form, even without any modification from your side – you will not be able to submit new list items using it. InfoPath will give you an error: “InfoPath cannot submit the form because it contains errors. Errors are marked with either a red asterisk (required fields) or a red, dashed border (invalid values)”.  However, your form haven’t neither asterisks nor border. If you will look for error details, you will see “Field or group: Value Error: Only positive integers allowed”.

SNAGHTML24b1ca0

Reason of this error is “default value” Multiple Selection box has behind. Multiple Selection List Box is a XML repeating section. If you will look into “XML” data, you will see that new form will already have an empty element, which can’t be submitted to the list where field is required.

Solution is relatively simple – remove empty default element. To do it, under “File” menu in InfoPath, go to “Form Options” and under “Advanced” select “Edit Default values”. Navigate to your repeating element and just remove checkbox left to the Value. That’s all.

image

About these ads
This entry was posted in 2010, InfoPath. Bookmark the permalink.

2 Responses to List Form with Multiple Selection List Box

  1. Thank you for this post. Saved me hours of aggravation!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s