Replace link used for "upload files"

Home Forums vLooup for SharePoint Replace link used for "upload files"

Viewing 2 reply threads
  • Author
    Posts
    • #18764
      chgrnet
      Participant

        Is there a way to replace the link used for “upload files” when using vLookup to add files to a document library? I find that using a link to a web part page with the folder associate with the task is much better and would like for that to be the link used instead of the default upload file screen.

        What I did was create a web part page with a web part of the document library. I hid everything else on the page except for the section that shows the files and allows you to add new files. I have a folder manually created before files can be uploaded (I only allow files to be uploaded into a folder, not individually) for other processes. Because each task has one specific folder, I can tell the link for my web part page to open the correct folder where additions/removals can occur.

      • #18847
        Alexander Bautz
        Keymaster

          Hi,
          You can override the upload function used when you hover over a folder and click the blue upload icon by adding this in the custom js:

          spjs.vLookup.uploadToFolder = function(fin,url){
          	var o = {"autoSize":true};
          	spjs.vLookup.data.refreshThisField = fin;
          	url = "YOUR_CUSTOM_UPLOAD_URL";
          	SP.UI.ModalDialog.commonModalDialogOpen(url,o,spjs.vLookup.uploadCallback);
          };

          Change “YOUR_CUSTOM_UPLOAD_URL” with your custom URL.

          If it’s the “New document” button, you can override it like this:

          jQuery("#newItemWrap_vLookupDocuments").html("<span onclick='spjs.vLookup.uploadToFolder(\"vLookupDocuments\",\"\");'>New document</span>");

          Change “vLookupDocuments” with the name of your field.

          Alexander

          • #19159
            chgrnet
            Participant

              The first piece of code is excellent! Thank you!

              I have a single line of text field called “DocLibraryFolderName” I would like to append to the end of the “YOUR_CUSTOM_UPLOAD_URL”, how would I code that?

            • #19161
              chgrnet
              Participant

                Please disregard this question, I was able to figure out how to do what I needed. Thank you for all your help!

                This is an excellent solution to use when using vLookup to a document library, it is much nicer than the standard document upload screen.

              • #19299
                chgrnet
                Participant

                  New question: Is there also a way to get the “Upload files” icon to always be visible? Right now it only shows when you mouse over the area to the right of the folder icon, but I want it to always be visible.

              • #19303
                Alexander Bautz
                Keymaster

                  Add this to the Custom CSS in your DFFS config for that form:

                  .spjs_folder_btn{
                      display:inline!important;
                  }

                  Alexander

              Viewing 2 reply threads
              • You must be logged in to reply to this topic.