I was asked by a client recently if there was a way to create a hyperlink to a New Item Form anywhere within a site but still get the rich experience of the Modal pop-up window that grays out the background. (Note this is for SharePoint 2010 Only…)
I basically took the code directly from the “Add new item” and the “Add Document” link within the list view.
What this allows you to do is simply add in the following code to any content editor web part, Master page, or Page Layout in any site collection and display the form to be filled out. The user will get the nice experience of the modal window and not have to navigate away from their current page.
This could be used for example a feedback form that is included in the master page so whenever someone wants to give feedback it is always going back to a central list. The only that is required for you to know is the List ID and the site name.
Full Code For a List Item:
Full Code for a Library Item:
Upload a Document</a>
What you need to change:
URL: Change “SiteName” to your URL
List ID: Change the list ID to your custom list/library ID
- To find out the list/library ID, simply navigate to the list/library you want to display and then click on list settings
- Look at the end of the URL.
- You will get something similar to this:
- Remove the first %7B and the last %7D
- Then change all %2D’s to “-“
- So the final would be 94AC86A8-6774-4822-A197-A98542251678
You could also add in an image right within the <a> tag and make a nice button for users to click on. Once you have customized the code you can now simply add the code to any page on the site and you will get the following results:
Site Collection 2 hyper linking to a list on Site Collection 1