SharePoint: Force the New button to show Content Type choices


Note: The following only applies to SharePoint 2007, but I'm looking into a similar fix for 2010.


Content Types add a lot of value to SharePoint, if you can get your users to use them. When you upload a document to a library where you have Content Types enabled the user is always asked to pick a content type.


But when a user is working with a list, such as Tasks, and clicks the New button they always get the default Content Type. If they knew about the option, and they remembered the option, they could click the little dropdown arrow next to new and pick a Content Type.



But what if they don’t know about the dropdown options? When they mouse over the “New” button they see a tip that implies clicking New will open a menu. But, it does not. It just creates the default Content Type.


Want to fix the new button?

To fix the New button you will need to edit every page that has a New button (that you want changed) or edit the site’s master page. (To see how to add this JavaScript to a single page or to the master page see http://techtrainingnotes.blogspot.com/2012/05/adding-javascript-and-css-to-sharepoint.html)


Here’s the script:

<script type="text/javascript">
var ttnNewMenu;

//get all tables
var ttnNewMenuTables = document.getElementsByTagName("TABLE");
//find the NewMenu table
for (var i=0;i<ttnNewMenuTables.length;i++)
  if (ttnNewMenuTables[i].id.indexOf("_NewMenu_t")>0)
    ttnNewMenu = ttnNewMenuTables[i];

//if we found it, copy the dropdown JS into the New onclick attribute
if (ttnNewMenu != null)
  var ttnDropDownJS=ttnNewMenu.childNodes[0].childNodes[0].childNodes[1].onclick;
  ttnNewMenu.childNodes[0].childNodes[0].childNodes[0].onclick = ttnDropDownJS;




Anonymous said...

Does anyone know if there is a similar solution for SP 2010?

Anonymous said...

Still works great for SP 2007!

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.