Wednesday, November 30, 2011

Utilizing SharePoint 2010 Modal Dialogs ANYWHERE

I've noticed that I have been utilizing model dialog boxes quite a bit at a few different clients. The simple idea of navigating without actually going anywhere is awesome! No more people getting lost in breadcrumbs, no more portal connections, no more confusion.

Is this SharePoint's fault? I don't think so. I put the blame on the end User not wanting to learn 2-3 different ways to navigate through a Site Collection. The majority of End Users that I work with have no idea what a "Breadcrumb" is. What they do get is how to click on a link, and hit the "X" in the top right of a window to make it go away. So here is where I give you the solution...


Simply put the following script in a content editor web part on a page (or in your master page).


function openCreateTicketDialog(formUrl, title)
{
var options =
{
url: formUrl,
title: title,
showMaximized:true
};
SP.UI.ModalDialog.showModalDialog(options);
}




Now all you have left is to create link to call your openCreateTicketDialog function.

javascript:openCreateTicketDialog('http://www.google.com', 'ITS GOOOOOOOGLE');

I'll try to follow up to this post with the Powershell Script that lets you add these links to your sites navigation ;)