Wednesday, August 3, 2016

InfoPath - Multi Choice Value Field - Default Values

From the below article: https://social.msdn.microsoft.com/Forums/en-US/6d30678f-acfa-4b4d-bffc-2705de86c0c2/infopath-multi-choice-value-field-default-values?forum=sharepointcustomizationprevious
--------------------------------------------------------------------------

the default values set in the SharePoint list do not carry over into InfoPath.  Not to mention, there is no option to select multiple default values for the Multiple-Selection List Box control within InfoPath.  The good news is we can make InfoPath display these values by default by modifying one of the source files that make up the InfoPath template.
When you first open an InfoPath XSN to fill in a new form, it uses a file called "template.xml" to know what data to display as default.  This file is stored in the source files that make up the XSN.  What we need to do is modify this file to include more than a single value as its default value.
The easiest method for accomplishing this will be the following:
  1. Open the list form template in InfoPath Designer.
  2. Go to File >> Publish >> Export as Source Files.  Choose a folder to save these to.
  3. In these source files you will see the template.xml file.  Open this in your favorite text editor.
  4. Search for the section in this XML file which contains the name of the Multiple-Selection List Box data.
Names may be different:
<my:multidefault_x0020_checkboxes>
    <Value>Apples</Value>
</my:multidefault_x0020_checkboxes>
Add the list of choices you would like to be checked by default, so it looks similar to this:
<my:multidefault_x0020_checkboxes>
    <Value>Apple</Value>
    <Value>Orange</Value>
    <Value>Grape</Value>
    <Value>Pear</Value>
    <Value>Etc</Value>
</my:multidefault_x0020_checkboxes>
Save this file and go back to the XSN's source files.  Right click on the manifest.xsf file and go to Design.  Quick Publish back to the server

No comments:

Post a Comment