Customize the NewForm.aspx

Posted on Updated on

My blog has moved to Mindsharpblogs. You will find this post there along with my newer postings. If you would like to leave a comment, please check out the new location. Thanks for dropping by.

Have you ever wanted to change the fields presented in a form when you create a new announcement or task for your SharePoint team site? Do you wish you could remove a field or two in order to keep someone from changing important metadata once a document has been uploaded into your library? Perhaps you would simply like to expose different fields to different users when editing information in a document library or list. Well, follow along with me now because I’m going to take you on a short journey and show you how to do just these very things.

Hello, my name is Daniel A. Galant and for the past several months I have been employed as an instructor with Mindsharp, the SharePoint people. One of the questions that keeps coming up in our sessions is “How can I change the default new item or edit forms to present only the data fields I want certain user groups to be able to modify?” To begin, let’s take a look at just what it is we are trying to change.

When you want to enter a new item into, let’s say, your announcements list, SharePoint calls upon the NewForm.aspx page for that list, in this case, announcements. The page contains a customized List Form Web Part that displays default columns associated with the Announcements list properties. The New Item form cannot be edited within the browser, so in order for us to accomplish what we want to do, we will need to call upon our trusted companion tool, SharePoint Designer 2007.

To begin our modification journey let’s start by opening up a team site in the browser and taking a look at the default New Item page that we have to work with. Figure 1 shows the home page for the Technical issues team site that we will be modifying.


Figure 1: Technical Issues home page

By selecting the Add new announcement link we are presented with the standard Announcements: New Item page (Figure 2) for adding announcements to our list. Note the columns that are currently available for data entry: Title, body and Expires.


Figure 2: Announcements: New Item page

To modify this page we must open it in SharePoint Designer 2007 and then add a new custom List Form Web Part that displays only the fields that we wish our users to modify. Start Designer and then connect to the website that contains the list whose form you wish to modify, in our case that would be the Technical Issues Team site as shown in Figure 3.


Figure 3: Technical Issues site loaded into Designer 2007

Next we need to open up the relevant NewForm.aspx page. In the Folder List expand Lists and then expand the list you want to work with. Again, we are going to modify the Announcements list so expand Announcements and select NewForm.aspx.


Figure 4: NewForm.aspx in the Announcements list

As you can see in Figure 5, the Announcements: New Item page contains a customized List Form Web Part that will display the fields we noted earlier when we opened the page in the browser. While we can edit the properties of this particular web part, we cannot edit the contents, nor do we want to delete the web part from the page as this can break the NewForm.aspx page and cause it to error out when you try to actually use it in your site. Stick with me because we are going to cover how to deal with this as we go though this tutorial. For now, we want to add some space below the current web part so that we may add our own custom list form to do with as we like.


Figure 5: The default NewForm.aspx page

Select the area just below the current list form and press Enter twice to give yourself some room to work with. Next, to add our custom list form go to your tool bar and select Insert>SharePoint Controls>Custom List Form.. as shown in Figure 6.


Figure 6: Add a new Custom List Form

Selecting the Custom List Form will bring up the List or Document Library Form dialog shown in Figure 7 where we need to choose which list we are tying this new web part to as well as the type of form we want to create. In our example we are keeping the default Announcements list since we are creating a new Announcements form as well as selecting the New item form radio button because we want to use this web part to create new announcements for our site. If we were going to modify the web part for a different document library or list within our site we would need to choose that library or list from the drop down menu. If instead of creating a new item, we wanted to use this form to edit an already existing item; we would select the Edit item form radio button instead.


Figure 7: List or document library selection dialog

When finished you should have your new list form web part as displayed in Figure 8.


Figure 8: Newly added List Form web part

As mentioned earlier, the form we are using is pulling its data fields from the columns that are defined in the list or library that we are connecting the web part with. What if we want to create our own columns or collect information about items that are not currently part of the list or library? To do this we would need to add additional columns from already existing Site columns or simply create our own to suit our needs. To accomplish this task we must venture into the settings of the list or library that contain the items we want to collect or modify data from.

We’ll start by selecting the View All Site Content link at the top of our Quick Launch menu at the left hand side of the browser window. This will bring up the All Site Content screen as seen in Figure 9. Next we must select the list we are working with, in our case that would still be Announcements.


Figure 9: The All Site Content page

Once you are in the list or library that you want to add information to, select the Settings menu and then select List Settings, (Figure 10).


Figure 10: List Settings menu option

On the settings page for your list or library you will see a section titled Columns, (Figure 11). It is here that we can add columns from the already defined site columns in SharePoint or create a new column to collect whatever data we need for the items in our list.


Figure 11: Create or add new columns section

When you have defined the metadata types that you wish to collect on your list items, we need to make those columns available in our new List Form Web part. To do that, we’ll go back to SharePoint Designer 2007 and add the form elements into our new form.

In the Toolbox task pane you’ll notice a section labeled SharePoint Controls (Figure 12). If the Toolbox is not visible in your Designer, go to the Task Panes menu item and select Toolbox. Expand the SharePoint Controls and you’ll see the various elements that can be inserted into your form to allow you to collect the data that is relevant to your list items. These elements directly map to the column data types that are defined when you add or create a new column in any library or list within SharePoint.


Figure 12: SharePoint Controls in the Toolbox task pane

Select the data view control that maps to the type of field whose data you wish to collect and drag it from the toolbox and drop it into your new list form. This will bring up a control dialog in which you will map the control to the column in your list whose data you are interested in. You’ll notice in Figure 13 that we dropped a text box into our form and we are going to map it to the Modified By field in our Announcements list.


Figure 13: Mapping a list field to a data view control

Next we merely give our new control the proper label, (Figure 14) and then save our new NewForm.aspx page.


Figure 14: Adding the label for our control

Since we are modifying the default page you will receive a warning (Figure 15) that the page is being altered from the site definition. Select Yes to save the changes.


Figure 15: Site definition warning dialog

Now we can view our new New Item page in the browser and see just what we have done. As you can see in Figure 16 there are now two list form web parts on the page; our original web part with the default configuration of fields, and our new web part with its modified content.


Figure 16: New Item page with two list forms

Since we want to present only a single form for our users to fill out, with only the items we have selected for them to modify, we must hide the original web part on the page. To accomplish this we again return to Designer 2007 and the NewForm.aspx page we have been working with.

Select the original ListFormWebPart and hide it by right-clicking and selecting Web Part Properties from the popup menu. (Figure 17)


Figure 17: Selecting Web Part Properties popup

In the Announcements properties expand Layout and check the box for Hidden (Figure 18). Again, we don’t want to delete the default web part since this can break the page and cause it to error when trying to load within SharePoint. Remember to save the new page.


Figure 18: Hiding the default Announcements web part

We now have our Announcements: New Item page that only displays the elements that we want to expose to our users as seen in Figure 19.


Figure 19: The new Announcements: New Item page

Using the principles shown here you can create a form to display any of the content columns that are associated with your lists and libraries in your SharePoint deployment. But what about exposing different columns to different sets of users? By applying what we have learned here you can create separate web parts that expose only the columns you want exposed for each set of users and then apply audience filtering to make them accessible to the proper groups.

So what about removing elements from the Edit Item form so that metadata isn’t improperly changed when a user edits the properties of an existing document? Let’s take a quick look at the Edit item page for a document library where content types are enabled. Notice in Figure 20 in our Problem Reports library App Crash document properties there is a field to select the content type that is associated with this document. A misinformed user could potentially change the content type associated with this document and thereby change the metadata or even workflow’s attached with this document type.


Figure 20: Edit Item page showing Content Type selection box

To prevent this situation for occurring we need to modify the default EditForm.aspx page that is associated with this document library. To do that we need to use Designer, just as we did when modifying the NewForm.aspx page earlier.

Start by connecting to the site that contains the document library (our Technical issues site) and then locate the library you want to work with (Problem Reports in our case). Expand the library and you will see the associated forms as shown in Figure 21. This time we want to modify the EditForm.aspx page so open it with Designer.


Figure 21: Selecting the library to work with

Now just as we did with our previous NewForm.aspx page we need to add a new list form web part to the page and hide the existing default web part from our users. This time, however, when we insert our new web part we must be sure to connect it with the proper library (Problem Reports) as shown in Figure 22 and then select the proper form type (Edit item form) that we are creating as shown in Figure 23.


Figure 22: Connecting the form to the proper library


Figure 23: Configuring the List Form Web Part

From there it is simply a matter of configuring the field types, adding the proper SharePoint controls and saving our page. Figure 24 shows the modified Problem Reports library Edit Item page without a content type selection box.


Figure 24: Edit Item page without the Content Type selection box

So there you have it. You can now modify your default forms to display just the fields you want them to while hiding the ones you need to. I hope you have found this tutorial useful and if you should have questions or comments, please let us know. Till next time…

51 thoughts on “Customize the NewForm.aspx

    milissa said:
    February 25, 2008 at 3:13 pm

    Hi Daniel, this is a great article. I’m trying to customize the newform.aspx to show some fields to all users and select fields to a target group. As you suggested, I added a new webpart with the targeted fields and used an audience to show it. But when I create a new list item when both webparts are visible, only the fields in the bottom webpart get saved to the list. If I create as a user where only the top webpart is visible, the data in the top one gets saved. Anything you can suggest would be appreciated.

    Daniel A. Galant said:
    February 26, 2008 at 5:11 am

    Since the form will only collect data from a single web part, you need to ensure that whichever metadata columns that you wish to collect information for are present in the Web Part that is being displayed to the given user. This might mean that you need to create one Web part to display Set A of your columns, another Web part to display Set B with a third to display Sets A and B.

    Mike said:
    February 27, 2008 at 8:23 pm

    WOW! I’ve been struggling for 2 days to figure out how to hide fields when inserting a new item into the list. These instructions worked like a charm.
    I’m using an Issue Tracker list, and only displaying the Title and Description to create a new issue. Then the admins can edit the list to use all the other fields. This works perfectly.

    mike said:
    April 23, 2008 at 8:00 pm

    When I work with a list, this works fine. However when I try to use a document library (as you explain), it does not work…. on inserting the library, nothing happens… Do you have a clue?

    Will said:
    April 23, 2008 at 8:47 pm

    Hi Daniel,
    Thanks for posting the NewForm editing process. Your process is the most comprehensive I found and very well layed out.

    Just what we needed!

    Daniel A. Galant said:
    April 24, 2008 at 1:04 am

    I’m not sure what is happening in your situation. Are you saying that when you choose a library for editing, no page loads that you can edit? Can you provide a little more information?

    Shankar said:
    April 25, 2008 at 4:29 pm

    Hi Daniel,
    Great Stuff !!
    Got a question, let’s say I update this form based on how I want it to look like. Now I have added a new column, however I am able to see it in order to update it. How can I accomplish this?
    Also the web-part permission, is it a MOSS thing?

    Shankar said:
    April 25, 2008 at 4:29 pm

    that’s “..however I am unable to see it …”

    Arno Gramsma said:
    May 6, 2008 at 8:51 am

    Hi Daniel,
    I followed your description to customize the NewForm.aspx.
    It works untill I hit the attach file link, then I get the following message:
    error on page. Details: Can’t move focus to the control because it is invisible.
    Can you help?

    Ed said:
    May 8, 2008 at 8:38 pm

    Hey great article. I’m having the same issue as Arno – attachments & custom forms. Have you found a way to get the attach file component to work with this custom form? I’ve tried this process and end up with the same javascript error – probably because the object exists twice on the page. According to MS & other blogs, this is a known issue that should be addressed in SP2. Did you run into a fix by chance?

    Chris said:
    May 14, 2008 at 2:46 pm

    Hi Daniel,
    a great article. However I utterly fail the moment I try to insert the listview webpart. Here’s my scenario:

    I have the Microsoft Application Template : Helpdesk for WSS 3 installed and I’d like to customize the input form. I created a copy of the newitem.aspx (called newitem2.aspx). I follow your instructions but simply nothing happens. In SPD the filename gets the ” * ” next to it indicating a change was made. But even comparing both newitem.aspx on code level shows no difference between them after saving, closing and reopening newitem2.aspx.

    I have reinstalled SPD and downloaded all updates for SPD, Office, Windows, etc. My Server is a WSS3 (no SP 1). I have set trust level to full in the web.config but nothing helped.

    Maybe you or someone else around has an idea.

    Thanks for your help

    Best regards


    Daniel A. Galant said:
    May 15, 2008 at 2:29 pm

    Sorry it has taken me a while to get back on some of these. Let’s get going…

    Shankar – if you add another column to your Library or List it won’t be automatically loaded into your custom form. You need to reopen the page within Designer and add the column, just as you did when you created the form originally.

    Arno and Ed – I still haven’t had a chance to look into the attach file issue. As soon as I do, if I find something I’ll post back.

    Chris – I’ll need to look at the Help Desk Template to see what might be happening there before I can answer the question. As soon as I do, I’ll report back.

    Daniel A. Galant said:
    May 15, 2008 at 3:05 pm

    Chris – I need to be sure I am looking at the same thing you are with this. Are you referring to the Service Request NewForm.aspx page?

    JasonD said:
    June 4, 2008 at 3:58 pm

    “Nothing Happens” problem solved.

    Goto the Central Administration site, click on Operations then at the bottom of the screen click on “Data Retrieval Service”. Now make sure “Enable these data retrieval services” is checked (on the right first on the list), save and restart IIS for good measure.

    saurabh gupta said:
    June 16, 2008 at 12:34 pm

    its great article but i want to create my own view for list
    can u help me out
    thanx in advance

    Oliver said:
    July 11, 2008 at 11:00 am

    thx a lot. Great timesaver!


    Vairamuthu said:
    July 17, 2008 at 5:47 am


    I need to show and hide the contols depending on user credentials.I have a task list with 25 columns depending on user credentials i need to show and hide the columns in Allitem.aspx,Edititem.aspx,DisplayItem.aspx,Newitem.aspx.

    Example “Final Approve” this column only show for manager likewise “Basic Approve” this column only show for “Basic approver” not for Manager.

    Daniel A. Galant said:
    July 17, 2008 at 11:35 am

    In order to show different columns for different types of users you need to add additional custom List forms, each with the particular columns you need them to have. Then you’ll need to set Audiences for each of these different webparts so that they only show to the proper groups.

    Paul said:
    July 18, 2008 at 9:41 pm

    Is there a way that you can “modify” an exsiting “Custom list form”? I’m trying to add 1 field to a “New KPI” form, but using the “normal” way of creating a new NewItemForm.aspx creates a brand new form and not the one that was there before.

    I would love to just had edit the form but can’t find where it is stored.


    […] SharePoint Happenings Blog has a great post about customizing forms for your lists. I am using this to get rid of certain fields that I do not want to be entered when […]

    Jane said:
    July 29, 2008 at 6:19 pm

    I have created a custom list form and deleted the original list form Web Part and get no errors, so what problems might occur by deleting the LFWP?

    Daniel A. Galant said:
    July 29, 2008 at 6:26 pm

    Jane, in every case I have seen where the original form web part is deleted, the page has since failed to load when a user goes to enter any data into it and SharePoint displays an error. If yours is working I’d be interested to know if you did anything differently.

    brana said:
    August 13, 2008 at 9:41 am


    i have customised newform.aspx page as you suggest and everything works fine except atachments.
    When i tried to atach file i got “error on page” browser message. In details : cant bring focus to hidden or invisible elements. Looks like visible “Attach file” link references hidden web part

    Any suggestion ?

    Thanks anyway, great post.

    Abin said:
    August 21, 2008 at 11:20 am

    hello friends plz help me up. In my newform.aspx i have 2 dropdowns ,second dropdown is depends on first dropdown’s selected value.

    Tim said:
    August 26, 2008 at 7:10 pm

    Hey Daniel,

    Great article!

    It appears that if I attempt to modify the layout of the form controls such as grouping them in Divs/Fieldsets, the OK button becomes inactive.

    If I follow along with the tutorial and do not attempt to change the fields, then the OK button works just fine.

    I can’t seem to isolate why this is happening.

    At this point I am begining to wonder if there is a problem with Divs/fieldsets in a webpart form.

    Although this was working last Friday. I have not touched the form since testing on Friday and no one in IT (supposedly) has not done anything on the server.

    Any thoughts would be greatly appreciated.

    Deepali said:
    August 29, 2008 at 9:13 am

    Hi Daniel,
    Great post.
    I have got a small query, if u cud help me out. How can i customize the error message for the required field. When a value for required field is not entered, it always gives an error message “You must specify a value for this required field”. I want to customize this message. How can i do this?

    One more thing, I want to put a required field validation on a field depending upon the value of a different field in the newform.aspx page .

    Any suggestions???
    Thanx in advance.

    Elyse said:
    September 17, 2008 at 9:02 pm

    I am trying to edit the EditForm.aspx for Service Requests. I have successfully edited the page (added an Hours Worked field), but when I deploy the new page to the site and try to edit existing items on the request list, the edit form is blank. I’m assuming it’s because I’ve hidden the original web part. Is there a way to have the original EditForm.aspx apply to old service requests and have the new EditForm.aspx apply the new requests?

    Indra said:
    October 20, 2008 at 6:36 pm

    Hi Daniel..Great Post.. I did this long back. But i am struggling with another thing here. can i add gridview.. i can see that i can drag and drop from SPD.. But can i use c# in line code?.. I dragged and dropped the grid and then wrote a code for adding columns and Rows to it.. but when i save and run in browser.. its says some error and when i see eventview.. what ever i add(like button..or gridview1) its says it does’nt exist in the current context.. i did same thing in the VS and it works.. but not in SPD.. can i know in which placeholder i shd add.. so that it can know that i am taking gridview which i dragged and dropped?

    David Goebel said:
    October 22, 2008 at 8:17 pm

    I have been able to customize the NewForm page with a dropdown list that is bound to a filtered data source. No errors are produced and I am able to create new items in the list and save them without issue. However, I am having trouble with getting the corresponding customization to work on the EditForm page.

    The problem is that when I click on “Data Fields…” to bind the dropdown to the data source, the data fields for both display text and value do not show up in the “Change Data Bindings” dialog box. When I click the OK button, it then puts blank properties for these items as datatextfield=”” and datavaluefield=””. When I attempt to edit an item, I get a browser message that says “An unexpected error has occurred.”

    If I then go back into the code and manually add the correct properties (which are datatextfield=”Flow_x0020_Addition” and datavaluefield=”ID”), I am able to open the item to edit it… however, when I make a change and then click save, I then get a browser message that says “Data Source Conflict: Your changes conflict with those made concurrently by another user. Refresh the form and submit your changes again.”

    What am I doing wrong and/or what else do I need to do?

    Ferdous said:
    November 4, 2008 at 4:00 pm

    But Target Audience doesnt work for Custom List Form Web part. I was customize my task list newForm.aspx using ur article.

    So i set different audience for two web part. but doesnt work properly. i set this value from the sharepoint designer in Web Part Propertise –> Advance –> Target Audiences.

    Please let me know if you have any idea.

    Raz said:
    November 12, 2008 at 10:56 am

    Hi Daniel,

    This was one good article.

    Amy said:
    November 13, 2008 at 9:42 pm

    Hi, I tried to add 2 web parts – one displays information for the general user to edit, the other displays all of the information for the admin to edit. The problem is, this works for the general user (using target audience on the webpart) – but the admin users is stuck with 2 forms on the page…. any way to do this since the admin is a member of both groups.

    Daniel A. Galant said:
    November 13, 2008 at 5:29 pm

    Amy – if the user is a member of both target audeinces, I don’t know of a way to only display one of the resulting forms as a preference. You might want to look at removing them from the general users target group. this would mean that wherever else you used this target audience you would need to add the more specific admin group as well.

    Sukesh M Menon said:
    November 18, 2008 at 3:31 am

    Hi Daniel,
    Its a very useful article in deed. I was looking for the same feature. But with some more addition features.

    I need to give some condition on the “OK” button and I have a javascript file which i want to use for this. On click of this button a paticular function in the javascript should trigger and it validates the values.

    How can I achieve this?


    Amy said:
    November 19, 2008 at 1:19 pm

    Hi – do you have any idea why suddenly the ‘Target Audience’ setting would just disappear. It is gone. I was just working with this a day ago. Now when I go into SPD or SP to edit a web part – the Advanced section does not have this option anymore?
    Very confused? Hope you can advise.

    Adam Lowe said:
    December 3, 2008 at 1:58 pm

    I have published a guide on my blog that shows you how to accomplish this within the Sharepoint GUI. No need to go into Designer for most folks on this one and if you do it the way I’ve laid out it doesn’t break anything.

    Mohammed said:
    December 3, 2008 at 10:22 pm

    Thanks SOoOSOOSOSssosoO Much

    Atul said:
    December 24, 2008 at 7:11 pm

    You can add the javascript reference in the file as:

    Save the file at the following location:
    C:\Program Files\Common Files\Microsoft Shared\web server
    In Custom.JS, you can write Javascript function PreSaveAction(). This function gets called when user clicks ‘Ok’ button. in this function you can validate your fields and even cancel the save operation by returning false value at the end. Hope this helps you.

    Atul said:
    December 24, 2008 at 7:13 pm

    You can add the javascript reference in the file as:
    Javascript file reference is not displayed correctly here, encoding the literals so that it should appear correctly.
    <asp:Content ContentPlaceHolderId=”PlaceHolderTitleAreaClass”
    runat=”server”> <!– This line already exist, add the custom.js after this
    line –>
    <SharePoint:ScriptLink name=”Custom.JS” runat=”server”/>

    Edit newform.aspx | keyongtech said:
    January 18, 2009 at 10:29 am

    […] the following article that told me what I need to know. Maybe someone else can use it as well.…e-newformaspx/ "JoelS" wrote: > Can I add a field to a newform.aspx? > > I have an IT Team […]

    Angela said:
    January 20, 2009 at 8:37 am

    Hi Daniel,
    I followed your description to customize the NewForm.aspx.
    It works until I hit the attach file link!
    The it does nothing.
    I saw another person posted the same problem, and I did not see a followup….did you happen to figure something out

    Marco said:
    February 5, 2009 at 11:29 am

    I still have the same problem as Arno and Ed. Any news about this?

    I can’t attahce a file, I get the error can’t move focus to the control because it is invisible.

    I am begging for help!!!!

      Daniel A. Galant said:
      February 19, 2009 at 5:37 pm

      Attaching files to a newform that has been edited simply doesn’t work and I have heard nothing from Microsoft if it ever will. Sorry.

    Clare said:
    February 8, 2009 at 12:34 pm

    I cannot thank you enough for publishing this artice. I have spent days trying to work out how to modify the “Finish” buttons on a survey to redirect the user to a different page upon completion. Your piece explains very clearly step-by-step how to achieve something that I was beginning to think I would never be able to work out. Thank you again!

    Astatke said:
    March 10, 2009 at 9:27 pm

    Regarding the attachment issues with customized forms – Microsoft has this knowledge base article (

    I followed this KB to solve my attachmnt issues but I still have javascript error.

    Astatke said:
    March 10, 2009 at 9:28 pm

    Sorry, here is the right link: for the KB.

    John said:
    March 11, 2009 at 8:57 am

    I had issues after I followed the above instructions, but I didnt follow them closely enough. Make sure you make the changes from “Edit” to “New” if its a new form, and, crucial this, the hidden list form webpart MUST be changed to hidden AND closed.

    After I did this it all worked as it should.

    Astatke said:
    March 11, 2009 at 11:55 am

    John – thanks for stressing the last item I overlooked in following up the workaround. Yes, you need to check both the “Hidden” and the “Close the Web Part” checkboxes. It now works for me too.

    What I also found out is that this workaround worked in our production MOSS server but not in the Development server. I am assuming that in our Development server the hot fix that Microsoft released in December 2008 has not been applied. Here is the hot fix,

    Ali said:
    March 16, 2009 at 8:00 am

    Hi Daniel ,

    Please guide me how to redirect a user to another page after completion of the survey?

    Help will be appreciated.

    Thanks in advance

    Sireesh said:
    March 19, 2009 at 2:47 am

    Hi Daniel

    I am facing an issue when attached a customEditFrom.aspx to the task list to a particular content. I clicked on the properties of the list and supported files there I selected particular content type and attached the new Custom EditForm.aspx. However this is not getting attached when I again go and the see the properties Supporting files it is showing the default EditForm.aspx for that content type but Iam able to attach it to the Task Content Type.

    Please Help me out….
    Thanks a lot

Comments are closed.