• Can we make this as mandatory

    By Surendar Madeswaran 1 decade ago

    Hi,



    In my case document should contain at-least one attachment. Can we make this as mandatory to attach file to the document. It will be good if I get the validation message on server side.

    • mandatory attachment

      By Mark Leusink 1 decade ago

      Assuming you use a document data source, you could check in the querySave event of the document if an attachment is available and send a message to the user if there isn't.

      Mark

      • Attachment Mandatory

        By Surendar Madeswaran 1 decade ago

        Mark,



        Thanks for your response, I have tried with

        "document.getAttachmentList("").isEmpty()"

        in querySaveDocument for the xpage.



        It is not working. Can you suggest me some other option.



        Thanks,

        • That won't work

          By Mark Leusink 1 decade ago

          Because the files are moved from a temporary document to the actual document in the postSaveDocument(). A call to the getAttachmentList() function in the querySaveDocument event will therefore (for new documents) always return 0 files. 

          Have a look at the moveUploadedFiles function to see how it retrieve that temporary document. You can used the same code in the querySaveDocument to check if files have been uploaded at all.

          Mark