[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Create an "Upload a Document" button web part in other document libaries

Posted on 2013-01-15
3
Medium Priority
?
3,786 Views
Last Modified: 2013-01-17
1. Created a subsite and used the "Document Center" template.
2. Exported the "Upload a Document" button from that site.
3. Uploaded the button web part to the Web Part Library.
4. On the Home page I added the "Upload a Button" web part.
5. The button works on the subsite fine.
6. On the home page the button will not open the "upload.aspx" page.

Here is a copy of the code for the button. They are exactly the same for both the home page and subsite.

<div class="ms-uploadbtnlink"><button onclick="javascript:OpenNewFormUrl(&#39;DropOffLibrary/Forms/upload.aspx&#39;);return false;" type="submit"><nobr><img alt="Upload a Document" src="/_layouts/Images/uploaddoc.png"/>&#160;<span>Upload a Document</span></nobr></button> </div>
0
Comment
Question by:mnoisette
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 11

Expert Comment

by:Guru Ji
ID: 38780222
You just have to specify the entire path for the form URL for upload.aspx in the home page.
For instance your website URL is

myintranet/home

and your subsite is

myintranet/departments/IT

then currently your upload for subsite pointing to
myintranet/departments/IT/DropOffLibrary/Forms/upload.aspx

you have to give FULL path on the code above
so that it knows which department or subsite library you trying to upload too.

Currently the URL is translated to

myintranet/DropOffLibrary/Forms/upload.aspx

and thats why it does not work
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 2000 total points
ID: 38780306
Hi,
this is because the function "OpenNewFormUrl" is only defined on the doc center page (and not on the root site home page).

Thats the function in the doc center:
function OpenNewFormUrl(url)
{
	var options = {width:720, height:480};
	SP.UI.ModalDialog.commonModalDialogOpen(url, options, null, null);
}

Open in new window


Either you add the function to your home page or you recode the button click:
<button onclick="javascript:var options = {width:720, height:480};SP.UI.ModalDialog.commonModalDialogOpen('/DropOffLibrary/Forms/upload.aspx', options, null, null);return false;" type="submit">

Open in new window


Please be sure and check the Url of the DropOffLibrary.

HTH
Rainer
0
 

Author Closing Comment

by:mnoisette
ID: 38789689
Worked like a charm!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you create your solutions on SharePoint sooner or later you will come upon a request to set  permissions of the item depending on some of the item's meta-data - the author, people assigned as approvers, divisions, categories etc. The most natu…
For SharePoint sites, particularly public-facing ones, there are times when adding JavaScript, Meta Tags, CSS Styles or other content to the page <head> section is more practical than modifying master pages.  For instance, you could add the jQuery l…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question