I've created a Sharepoint List form in Infopath 2010 and want to make sure that Attachment control has at least 1 file present. I've noticed that Rules are grayed out (disabled) when I select the Attachment field. I've a custom submit button which has set of rules. I want to validate the attachment control field.
Infopath doesnt allow validation rule for attachements. Below is a workaround.
- Create a text field to use for validating purpose (name it something like 'Attachment Validation').
- Place it on your form and remove the borders and shading. Open the field text box properties under the Display tab and set it to Read Only and set the default value to "Attachments"
Place a validation rule on this field. The condition should be 'The Expression' and set it to
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.