InfoPath: Validate that form has an attachment

I have found that I often need to make sure that people attach a file before they can submit. InfoPath will not let you run a rule on attachment fields however there is a way around it:

  • Create a single line of text field to use as the validation field (name is something like Attachment Validation). This field is also going to be the title text for the attachments field.
  • Place it on your form and remove the borders and shading.
    – go into text box properties under the Display tab and set it to Read Only
    –  then go to the Data tab and set its Default Value to the word “Attachment“.
  • Place a validation rule on this field. The condition should be The Expression and the expression should read like this:
    count(../my:Attachments/attachmentURL) = 0

The expression basically counts the number of attachments and if it equals 0 then it will put the red dashed line around the word Attachment.

 

I found the solution on Max Morrow’s site:
http://maxmorrow.wordpress.com/2012/05/03/infopath-2010-validating-the-attachments-field/

This entry was posted in InfoPath, SharePoint and tagged , , , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Your email address will not be published. Required fields are marked *