Skip to main content

Search

Check Document has been uploaded

Comments

6 comments

  • Matthias Walter

    Hi David Beckinsale,

    for this scenario I would implement the upload file function by myself and set the checkbox using jQuery if the result is 1. If you press cancel on the upload dialog, the result will be 0.

     

    function OpenModalDialogFileUploadSetCB() {
      var options = {
            url: '/sites/test_mwa/demo/_layouts/15/Upload.aspx?List=2e066082-0ee1-47c2-af6c-b67784fd4cff',
            title: 'Upload Document',
            allowMaximize: false,
            showClose: false,
            width: 800,
            height: 600,
            dialogReturnValueCallback: function(dialogResult,returnValue){        
              if(dialogResult==1){
                   jQuery("span input[title=File1Submitted]").prop("checked", true);
              };
            }
      };
    SP.UI.ModalDialog.showModalDialog(options);
    }

    OpenModalDialogFileUploadSetCB();

     

     

    BR Matthias

    0
  • David Beckinsale

    Hi Matthias,

     

    Thank you so much, works really well.

    I would also like to set a target folder as the documents all sit in their own subfolders off the document root.  The option is in the original Upload Document action as target folder.  How would i implement this, can i use RootFolder as an option or would i need to include this as part of the url after the guid ?  I will need to pass in the [[ID]].

     

    Thanks again,

    0
  • Matthias Walter

    Hi David Beckinsale,

    you're welcome.

    Yes you can use the RootFolder Parameter in the url like this:

     

    var currentID = [[ID]];
    function OpenModalDialogFileUploadSetCB() {
    var options = {
    url: '/sites/test_mwa/demo/_layouts/15/Upload.aspx?List=db313434-7538-4156-9bad-eff7e4103b60&RootFolder=%2Fsites%2Ftest_mwa%2Fdemo%2FContactDocuments%2FContacts-'+currentID,
    title: 'Upload Document',
    allowMaximize: false,
    showClose: false,
    width: 800,
    height: 600,
    dialogReturnValueCallback: function(dialogResult,returnValue){
    debugger;
    if(dialogResult==1){
    jQuery("span input[title=File1Submitted]").prop("checked", true);
    };
    }
    };
    SP.UI.ModalDialog.showModalDialog(options);
    }
    OpenModalDialogFileUploadSetCB();

     

    BR Matthias

    0
  • David Beckinsale

    Hi Matthias,

     

    Thank you.  That works great.

     

    I've just uploaded it to my customer site, but their site url is slightly different after the /sites/ folder and and I get the something went wrong message.  Can anything be done about this or will I have to use their url or would I be better off re-deploying it so that both url's are the same.

     

    Thanks again.

    0
  • Matthias Walter

    Hi David Beckinsale,

    therefore just make the rootfolder dynamic as well to make it work everywhere (specifically check line 1 & 4):

    var encodedRootFolder = encodeURIComponent([[@Web.ServerRelativeUrl]]+"/ContactDocuments/Contacts-"+[[ID]]);
    function OpenModalDialogFileUploadSetCB() {
      var options = {
                 url: '/sites/test_mwa/demo/_layouts/15/Upload.aspx?List=db313434-7538-4156-9bad-eff7e4103b60&RootFolder='+encodedRootFolder,
                 title: 'Upload Document',
                 allowMaximize: false,
                 showClose: false,
                 width: 800,
                 height: 600,
                 dialogReturnValueCallback: function(dialogResult,returnValue){        
                   if(dialogResult==1){
                             jQuery("span input[title=File1Submitted]").prop("checked", true);
                   };
                 }
                };
    SP.UI.ModalDialog.showModalDialog(options);
    }

    OpenModalDialogFileUploadSetCB();

     

    BR Matthias

    0
  • David Beckinsale

    Thank you Matthais.

    0

Please sign in to leave a comment.