Make client side changes in SharePoint list’s NewForm.aspx or EditForm.aspx

Okay guys! Another very simple but very useful & interesting SharePoint post. I love when I come up with quick solutions.

Scenario: You create a list in SharePoint (of any type). When you click on New/Edit SharePoint opens new page. If you see URL you will see Lists/ListName/NewForm.aspx in case of if you pressed ‘NEW’ and Lists/ListName/EditForm.aspx in case if you edit an item.

Requirement: Client wants to add some kind of image on NewForm.aspx & EditForm.aspx and also wants to hide cancel button.

Quick solution that comes to mind: A very quick solution generally comes to our mind is to add some kind of javascript and on window load just add image from picture gallery or 14hive or any other location. Does that make sense? Yes, it does ;-)

Now in SharePoint: Na na na… You are in SharePoint and here you must know where to hit :-P so I will tell you how you will do it in SharePoint.

A clean way to do so is to add a content editor webpart on those pages and add whatever javascript you want to add. Isn’t it clean guys ;-) but question is how? So simple solution is in the URL of the page pass this as query string parameter: Toolpaneview=2 and you will see that your newform.aspx or editform.aspx page will open in edit mode (based on permissions of course) and here you can add a content editor webpart and hopefully we all know that we can write anything in content editor webpart. Isn’t it cool? Well it makes a lot of sense and is a clean solution as well.

Bottom line is use ToolPaneView=2 or ToolPaneView=3 as query string parameter to open newform.aspx or editform.aspx in edit mode (which is not available by default). This can be used to increase column width or hide cancel button or add an image on the page or change width of lookup fields (as far as you know how to write a perfect javascript) :-P

This way you can avoid creating a custom feature and also will avoid doing any builds on production server. I hope it will help you guys. Good luck! And Happy SharePointing.

1 Comment

  1. pohhl

    Why don’t you just use .css? And an example or two would be useful. Thanks.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: