Search This Blog

Monday, June 20, 2011

Pre-Populating a Repeating Table in InfoPath 2010

Scenario:  Client wants their users to be able to add and delete choices from a table.   The number of choices will vary from form to form.  So this calls for a repeating table.   But how can I pre-populate the form in a way that the users can delete the pre-filled data if it's not needed?

I searched and search the Google-sphere for this one.  The closest I came was this solution for InfoPath 2007 from    S.Y.M. Wong-A-Ton

InfoPath 2010 does things a bit differently, but that blog helped along the way:

 1.  Add a repeating table to your form.




 2.  In the fields section, right click on the field and change the property to "Repeating".


 3.  On the form, right click on the field and "Change Control" to "repeating table".

Now we have a nested repeating table.  

 4.  Right click on the outermost table.
 5.  Click on "Repeating Table Properties"
 6.  Click "Edit Default Values".


 7.  Right Click on the repeating field.
 
 8.  Click on "Add another (field name) below.
 9.  Repeat step 8 until all the fields to be pre-populated are created.  


10.  Click on the 2nd field created.  Fill in the desired value.


11.   Repeat until all values are added
NOTE:  Leave the first  field empty.  
Completing this field will pre-populate any new fields to be added.
12.  Click ok.
13.  Click "Customized Commands"
14.  Optional:   Deselect all actions and click ok.

NOTE:  This will prevent the users form adding new columns multiple ways.

15.  Deselect the "Show Insert button and hint text" command.

NOTE:  This will remove the "Add New Item" from the outermost repeating table. 
Failure to do this step will enable users to add multiple versions of the innermost table.


What it looks like:

NOTE:  I configured my  "Customized Commands" so that my users can only remove these items.
 Any questions??