locked
how to make attachment as mandatory in infopath when it is in repeating section? RRS feed

  • Question

  • Hi,

    I have a infopath form where i am using attachment as mandatory, where the attachment was in repeating section.

    Actually i made attachment mandatory with a variable and wrote a validation on the variable. When i have deleted the attachment the validation is not working.

    • Changed type naveen1703 Friday, March 11, 2011 1:26 PM
    Friday, March 11, 2011 12:59 PM

Answers

  • You shouldn't need a 2nd field for this.  What you can do is in your datasource, right click the attachment field (the datasource it is bound to) > Properties > Validation(tab) > Add:

    Attach is blank

    <Enter Screen Tip Message>

    • Marked as answer by naveen1703 Friday, March 11, 2011 3:42 PM
    • Unmarked as answer by naveen1703 Friday, March 11, 2011 3:43 PM
    • Marked as answer by Mike Walsh FIN Friday, March 11, 2011 4:03 PM
    Friday, March 11, 2011 3:01 PM

All replies

  • How are you setting this field as mandatory? If you right-click it and go to file-attachment properties > Data Tab > Check the box next to "Cannot be blank" all of the fields should be required.
    Friday, March 11, 2011 1:35 PM
  • No, i have taken a new variable as hidden, and i wrote validation on that. right click the variable>Validations >Attachment is blank >wrote a screen tip

     

    Friday, March 11, 2011 1:39 PM
  • Actually the problem is when i have deleted the attachment the validation is not working.
    Friday, March 11, 2011 1:44 PM
  • Again though, how are you setting this?  If you set it to be required as stated above the validation should work even if you attach a file & then remove it
    Friday, March 11, 2011 1:56 PM
  • I don't know why it is not working, as i mentioned i have taken attachment in repeating section, if i click on insert item at that time the validation is working, I have deleted without uploading any file, the validation is not working.
    Friday, March 11, 2011 2:06 PM
  • BUT you still haven't mentioned what your validation is???? How are you setting the validation?  Is it a rule, is it data validation, is it "cannot be blank"? If it is a rule or data validation what is your condition?  I cannot help you without knowing that.
    Friday, March 11, 2011 2:10 PM
  • i have taken a new variable as hidden, and i wrote data validation on that. right click the variable>Validations >(Condition)Attachment is blank >wrote a screen tip"Attachment is mandatory".
    Friday, March 11, 2011 2:19 PM
  • Do you have a rule on the attachment field to update this variable (or is this custom coded)? It sounds like it gets set when the attachment is attached, but it's not getting set when the attachment is removed
    Friday, March 11, 2011 2:34 PM
  • That is not custom coded, I didn't wrote any rule
    Friday, March 11, 2011 2:40 PM
  • Ok, can you please explain this variable then?  How does the variable know if there is an attachment or not?  Is this variable a field in your datasource?
    Friday, March 11, 2011 2:46 PM
  • Ya it is a field in my Data Source with Data type (text).

    If we uploads a document then it is not blank right, based on this the validation working

    Friday, March 11, 2011 2:55 PM
  • You shouldn't need a 2nd field for this.  What you can do is in your datasource, right click the attachment field (the datasource it is bound to) > Properties > Validation(tab) > Add:

    Attach is blank

    <Enter Screen Tip Message>

    • Marked as answer by naveen1703 Friday, March 11, 2011 3:42 PM
    • Unmarked as answer by naveen1703 Friday, March 11, 2011 3:43 PM
    • Marked as answer by Mike Walsh FIN Friday, March 11, 2011 4:03 PM
    Friday, March 11, 2011 3:01 PM
  • Thank u Melli this is working.

    • Edited by Mike Walsh FIN Friday, March 11, 2011 4:03 PM New question removed
    Friday, March 11, 2011 3:45 PM