Click here to Skip to main content
13,796,681 members
Click here to Skip to main content
Add your own
alternative version


20 bookmarked
Posted 31 Jan 2009
Licenced CPOL

SharePoint Customization Tricks - Part 3

, 31 Jan 2009
Rate this:
Please Sign up or sign in to vote.
Trick #4: Renaming the list form toolbar items!


This multipart series of articles is intended to help you getting ramped up with SharePoint Customization. It's about modifying the default SharePoint user experience, list forms customization, branding, skinning SharePoint portals, etc.

In Part 1, I introduced a generic function that you can use to hide the list view toolbar menu items (e.g. New Item, Upload, Edit in Grid view, etc.). In Part 2, I showed you how to remove items from the list form toolbar. If you haven't read both posts yet, I would encourage you do to that first (

After posting the previous articles, I received a lot of e-mails from SharePointers asking how to rename the items in the list form toolbar. That's why I decided to write Part 3 in the series. After I finished writing the article and taking some snapshots, another SharePointer asked me on MSDN Forums if it's possible to remove the Text while retaining the images, for instance, removing "Delete Item" while retaining the (X) rendered beside it. Today I'll show you to do both tasks by JavaScript.

Let's get started!

Trick #4: Renaming List Form Toolbar Items!

Sometimes, you need to rename some items in the toolbar rendered at the top of DispForm.aspx to match the List Name. For instance, you have a custom list named "Programs" that stores the courses offered by a university. It would be better to have "New Program" rather than the default "New Item" and "Edit Program" rather than "Edit Item". Sometimes, you just need to totally delete the text and just leave the images with a tooltip that explains the action performed on clicking them.





The following function can be used to achieve both tasks, just call the function passing the old and new names of the item. For instance if you need to rename "Add Item" to "Add Program", use renameFormMenuItems("Add Item","Add Program");. In case you need to remove the text and leave the image, call the function passing an empty string as the new name as follows: renameFormMenuItems("Delete Item","");.

renameFormMenuItems("New Item","New Program");
renameFormMenuItems("Edit Item","Edit Program");
renameFormMenuItems("Delete Item","");
function renameFormMenuItems(oldName,newName)
 var anchorTag;
 var allAnchorTags = document.getElementsByTagName('a');    
  for (var j = 0; j < allAnchorTags.length; j++)
   anchorTag= allAnchorTags[j];    
   if (anchorTag.innerText.indexOf(oldName)!=-1)

Kindly note that the function is case sensitive, so "New Item" will work while "nEw iTeM" is not gonna work.

Nice and easy, isn't it?

Now a question is imposing itself, how can we use this function? The answer is the content editor web part; please refer to trick #3 in the previous article for more information.

What about hiding the toolbar altogether?


There are a lot of solutions that imply unghosting the page using SharePoint Designer, but I don't prefer those solutions! Again, let's perform this task using JavaScript. I've included two functions in the zip file, one for renaming the toolbar items and the other for hiding the toolbar altogether! Waiting for your feedback.


  • 31st January, 2009: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ayman M. El-Hattab
Egypt Egypt
Ayman El-Hattab is a Regional Technology Solution Professional focusing on helping software professionals and organizations build better SharePoint Solutions using Microsoft Application Lifecycle Management (ALM) technologies and tools. Ayman has been in this role since 2010 and has presented at many conferences all over the Middle East & Africa about ALM, SharePoint, C#, and Business Intelligence technologies. Ayman is also a Microsoft Most Valuable Professional [SharePoint MVP] , ALM Ranger, published author and an enthusiastic speaker who enjoys working with the online and offline developer communities all over the world. Ayman is the founder of MEA ALM Community & SharePoint4Arabs, community lead at Egypt SharePoint User Group and an organizer of several SharePoint Saturday events. Outside of work, Ayman can be found watching soccer games, playing xbox or watching documentary movies.

You may also be interested in...

Comments and Discussions

QuestionRe: Customization tricks pt 3 Pin
Syed Abas20-Oct-09 18:22
memberSyed Abas20-Oct-09 18:22 
QuestionJS Hack Pin
dwatkins@dirq.net18-Mar-09 3:51
memberdwatkins@dirq.net18-Mar-09 3:51 
AnswerRe: JS Hack Pin
Ayman M. El-Hattab4-Apr-09 13:42
memberAyman M. El-Hattab4-Apr-09 13:42 
GeneralCannot get hide menu items to work Pin
Kevin McCloskey3-Feb-09 1:44
memberKevin McCloskey3-Feb-09 1:44 
GeneralRe: Cannot get hide menu items to work Pin
Ayman M. El-Hattab3-Feb-09 1:57
memberAyman M. El-Hattab3-Feb-09 1:57 
GeneralRe: Cannot get hide menu items to work Pin
Kevin McCloskey3-Feb-09 2:02
memberKevin McCloskey3-Feb-09 2:02 
GeneralRe: Cannot get hide menu items to work Pin
Ayman M. El-Hattab3-Feb-09 2:18
memberAyman M. El-Hattab3-Feb-09 2:18 
GeneralRe: Cannot get hide menu items to work Pin
Kevin McCloskey3-Feb-09 2:47
memberKevin McCloskey3-Feb-09 2:47 
GeneralRe: Cannot get hide menu items to work Pin
Kevin McCloskey3-Feb-09 3:06
memberKevin McCloskey3-Feb-09 3:06 
GeneralRe: Cannot get hide menu items to work Pin
Ayman M. El-Hattab3-Feb-09 3:47
memberAyman M. El-Hattab3-Feb-09 3:47 
GeneralRe: Cannot get hide menu items to work Pin
Kevin McCloskey3-Feb-09 3:42
memberKevin McCloskey3-Feb-09 3:42 
QuestionTrying to ger rid of the delete Pin
Amy Thompson2-Feb-09 8:28
memberAmy Thompson2-Feb-09 8:28 
AnswerRe: Trying to ger rid of the delete Pin
Ayman M. El-Hattab2-Feb-09 13:27
memberAyman M. El-Hattab2-Feb-09 13:27 
GeneralRe: Trying to ger rid of the delete Pin
Amy Thompson3-Feb-09 8:14
memberAmy Thompson3-Feb-09 8:14 
GeneralRe: Trying to ger rid of the delete Pin
Ayman M. El-Hattab3-Feb-09 12:06
memberAyman M. El-Hattab3-Feb-09 12:06 
GeneralRe: Trying to ger rid of the delete Pin
Amy Thompson4-Feb-09 5:49
memberAmy Thompson4-Feb-09 5:49 
Generalpretty gud Pin
lovedotnet1-Feb-09 19:58
memberlovedotnet1-Feb-09 19:58 
GeneralRe: pretty gud Pin
Ayman M. El-Hattab1-Feb-09 21:21
memberAyman M. El-Hattab1-Feb-09 21:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.181207.3 | Last Updated 31 Jan 2009
Article Copyright 2009 by Ayman M. El-Hattab
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid