InfoPath XMLWriter - Adding Rows in a Repeating Table That Contain a Boolean Field

Came across an issue today with an InfoPath form I am working on.

In the form there is a Repeating Table that contains within it both String and Boolean Fields.

In order to make the form prettier we have created custom buttons to add a row to the Repeating Table.  These button use an XMLWriter to add a new row.

For any new fields (String or Boolean) the writer does the following to create a blank Field:

writer.WriteElementString("fieldname", myNamespace, "");

The problem I had was that if you created Boolean fields like the line above, and then tried to Submit the form to SharePoint, you receive a validation error "Some rules were not applied.  InfoPath cannot submit the form"

Turns out the Boolean Fields were failing to validate with the empty string value.  

This was solved by putting in a value that isn't used in the form for the Boolean Field:

writer.WriteElementString("fieldname", myNamespace, "0");

Comments

Popular posts from this blog

SharePoint - Field type [FieldName] is not installed properly. Go to the list settings page to delete this field.

Office 365 Groups - Quickly find the GUID of a O365 Group

Export Group Membership From Active Directory Using Power Query