Archive for the ‘Microsoft Office 2007’ Category

Required fields in browserenabled Infopath forms

14. October 2009

Have you ever had to setup an Infopath form which had to be shown i a Sharepoint site with required fields? If you have you must have experienced the nasty red boxes that appears saying “Cannot be empty” and the red stars in the fields indicating that validation didn’t work out. In my case a web-designer called it a show-stopper, if the stars and the boxes couldn’t go away on required fields, so I have to figure how to make them go away and still make them required.

First of all I went away from marking the “Cannot be empty” checkbox since it gave me very little configuration for the validation-message, and instead I used the Data validation button in the textbox’s properties. Setting a validation here saying that the field could not be empty forced me to leave a validation-text, which again showed up in the red boxes in Sharepoint. DAMN.

Finally I ended up using the save as source files in the files menu to see excatly what was written in the manifest.xml in the xsn file. Opening the manifest.xml with notepad and search for the error gave me the following lines:

<xsf:customValidation>
  <xsf:errorCondition match=”/my:mineFelter/my:felt1″ expressionContext=”.” expression=”. = &quot;&quot;”>
   <xsf:errorMessage type=”modeless” shortMessage=”ERROR”></xsf:errorMessage>
  </xsf:errorCondition>
 </xsf:customValidation>

Simply deleting everything between ” and ” in the shartMessage property gave me what I was looking for. The field was validating, when it was submitted, but no red boxes and stars were shown :-)


Follow

Get every new post delivered to your Inbox.