By: Siddharth Mehta | Updated: 2010-11-26 | Comments | Related: > Sharepoint
In InfoPath Forms, one of the repeating controls is the repeating table. The repeating table can be used to facilitate entering multiple records in a structured tabular format.
One of the common problems with this control is that InfoPath doesn't provide any kind of out of box approach to set minimum or maximum limit of repeating table.
Let's explore some a solution...
Consider a scenario, where a form contains basic employee information of a particular business unit. And the business requirement is that the form should enforce at least 3 employees and at most 5 employees with basic details like their name, age and department.
InfoPath has a schema file as one of the source files. Using a schema file, we can configure the minimum and maximum capacity of rows in a repeating table.
Below in the image, you can see a sample form with "EmpInformation" as its repeating group name of EmpName, EmpAge and EmpDepartment.
Now to generate schema file, click on File -> Save as Source Files and save it into a folder. Open the same folder.
After opening the folder, you can see our desired file (which is most probably) named as "myschema". Open the file in notepad and it would look similar to below image.
In order to implement our requirement, we need to change the section highlighted in above image, to minOccurs="3" maxOccurs="5".
Now save the file and close it. Right click on the "manifest" file and click design. At this point you still will not be able to see the changes. Then, click on "Preview" form and you would be able to see three rows when the form loads. It is because we set the group minimum occurrences to three.
One of the issues with this approach is that when you try to keep rows less than what is required or more than the maximum limit, InfoPath will internally throw an error.
One of the ways this can be addressed is by using conditional formatting to disable insert or deletion of rows.
- Use this approach to define the limits of repeating information in the InfoPath forms.
Last Updated: 2010-11-26
About the author
View all my tips