Custom Edit Forms for SharePoint 2007 Lists

What a coincidence: last week a student asked a question that I couldn’t answer straight away and probably at the same time somebody posted a blog post solving the question! The question was how to customize the edit form that you get when you create or edit a list item in a SharePoint 2007 list (EditForm.aspx). In SharePoint 2003 you could do this trick by editing the page in FrontPage 2003, when your right clicked on the control on the page you could actually break the control into different controls. Optimistically I tried to do the same thing in the SharePoint Designer, although the right click menu didn’t show to option that I was looking for (there went my street credibility for that course :-) ). Kristian Kalsing explains it on this blog post how this works in the 2007 world:

  1. Open your site in SharePoint Designer.
  2. Browse to your list and open the 'NewForm.aspx' web form.
  3. Go File > Save As... and give the form a new name such as 'NewForm2.aspx'.
  4. Delete the default List Form Web Part from the page.
  5. Go Insert > SharePoint Controls > Custom List Form.
  6. In the List or Document Library Form dialog, select the appropriate list, content type and type of form.
  7. Click OK and a new Data Form Web Part is added with controls representing all the fields from the list (in my environment all the controls show "Error Rendering Control" but this does not affect the final result).
  8. In the newly added Data Form Web Part, delete the rows containing fields not to be shown to the user (ensure that fields being removed are not required fields without default values as this would prevent the user from submitting the form).
  9. At this point, you can do other customisation such as rearranging the fields if you wish.
  10. Save the site.


  • Nice one...

    We did the same for EditForm.aspx page. Its showing all the controls and updating the page successfully. But only problem is when we try to edit using "Edit Properties", its going to root site and giving error message.

    But when we give the correct url on the browser, then its working fine...

    Please feel free if the question is not clear...

    Please help me out from this problem...

  • did you notice that you cant add web parts to a page with the editform or the newform? I write about it in my blog, including a workaround.
    However, I wonder if the same problem exists with the changed forms. can you try?

  • When i followed the above steps, it gave me error

    "Type 'Microsoft.SharePoint.SPFieldUrlValue' in Assembly 'Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' is not marked as serializable. "

    I am using a hyperlink column inside my list.

  • Please after following this procedure it convert nicely
    In the form I have a lookup field and I want to lookup no at th full table but at the filtered part.
    How can I do that ?

    Thank you



  • Hi,

    When I followed the instructions to create the dataformwebpart, my attach file button no longer worked.

    The error that I received was "This form was customized not working with attachement."

    I am wondering if you have ran into the same problem?


  • Hi,

    I created the custom edit form as per requirement , but when i click "new" in allitems.aspx it gives error "Invalid page :)" ..Am not sure why is this happening.


  • Me too getting the same error " The Form was customized not working with attachment"

  • A better way (in my opinion) of doing this is by using the ListFieldIterator webcontrol (found in Microsoft.SharePoint.WebControls). Simply remove the ListFormWebPart on the page you want to customize (say EditForm.Aspx). Set the ControlMode property to Edit,Display or New, and it will render the fields accordingly.

    You can also exclude certain fields, by setting the ExcludeFields property to #FIELDNAME1;#FIELDNAME2; ...

    Took me a quite some time to figure this out (I even tried writing my own Iterator using Reflection) so I thought it might be worth sharing.

  • Hi, everybody...

    I am using the trial versions of SharePoint server and SharePoint Designer.

    I have a custom list with 3 fields (two text, one date): Title (required), Customer (required) and EntryDate (optional).

    Using the custom edit form, I confront a strange behavior. Whenever I try to edit a text field, if the date field is not blank, I get the following error:

    "The data source control failed to execute the update command".

    If the date field is blank, no problem occurs. If I edit a text field and the date field is not blank, in order to avoid the error I have to edit the date field with a different value. Of course, this is not acceptable.

    Any ideas?

  • I want to display all fields but only edit some fields and so I went to set the 'control mode' to 'display' for some fields and I found that this only works for text field but not for dropdown field or checkbox field. Any solutions?

  • Disturbed,

    Could you please explain in a little more detail how to use the ListFieldIterator webcontrol? I don't quite understand how you implement that.

    Also, did using the ListFieldIterator solve the error of "The Form was customized not working with attachment"?


  • Hi, I have too this problem "The page you have selected does not contain a reference to the correct SharePoint list. Please select another page"

    Any solution?

  • Gerdes:

    Well, ListFieldIterator is what ListFormWebPart uses to display the fieldcontrols of a content type. It will not show the toolbars usually shown by ListFormWebPart, however. If you need those and just want to customize the appearance of the form, you should edit the different templates found in \12\TEMPLATE\LAYOUTS.

    Anyway, here's some basic code to get the ListfieldIterator working in a webpart. You could probably add declaratively to a page as well.

    WebPart code(add reference to Microsoft.SharePoint and include 'using Microsoft.SharePoint.WebControls':

    protected override void CreateChildControls(){
    ListFieldIterator it = new ListFieldIterator();
    it.ControlMode = SPControlMode.Edit //can also be New, or Display

    //let's say we want to exclude the field "Title" in our form
    it.ExcludeFields = string.Format("#{0};", "Title");

    Now, just add your webpart to a page of your choice (like EditForm.aspx, for example). The webpart will display all fields except "Title".

  • I am running into the "The data source control failed to execute the update command" But with data views. I can insert, delete, and save an unchanged row; beut everytime I try to save an edited row it error. The only refrence I have found points to incorrect data type for the database (MS SQL Server 2000 sp4). Any thoughts?

  • This technique works great! However it breaks the upload attachment feature and throws the below error message.

    "This form was customized not working with attachment"

    Has anyone found a way around this or to evoke the attachement JavaScript?

  • Hii,
    I want to make all fields of my sharepoint site read only without touching Sharepoint Designer or Front Page 2003.
    The user should not be able to modify any of the fields from the editform.aspx
    I know that we can do it by writing JS in editForm.aspx but i have a problem that i can use any sharepoint editor.
    So is there any workaround for this.

    Thanks, Prashant

  • Hii,
    I want to make all fields of my sharepoint site read only without touching Sharepoint Designer or Front Page 2003.
    The user should not be able to modify any of the fields from the editform.aspx
    I know that we can do it by writing JS in editForm.aspx but i have a problem that i can use any sharepoint editor.
    So is there any workaround for this.

    Thanks, Prashant

  • Anyone solved the problem with attachments?
    "This form was customized not working with attachment"

    Regards, Jacob W.

  • Hi fellows!

    I've managed to show the current attachments in the list item, with the following code:

    I've also digged into the HTML/JS of a non-custom list form, and figured out that why the "This form was customized not working with attachment" message is show.

    In a non-custom form, the web-part has two sections:

    // Web part section

    // Attachment section

    When one clicks in the "Attach File" button, the javascript function hides "part1" and shows "partAttachment", or vice-versa.

    I tried to copy part of the HTML code of a non-custom form into my custom form, with no sucess.

    If anyone is willing to give a try, please, remember to post your findings!

    Regars, Murilo

  • Hi ,
    I am having a lil problem with a webpart on SP07.
    I have used a Page Viewer Webpart to display a classic ASP Page. I would like to change the behaviour of this WebPart when 'Edit' is clicked and 'Modify shared webpart' is selected. I would like it to display another ASP Page. Is this possible? Or else is it possible to add another option onto the drop down that comes when clicking on 'Edit' of the webpart?
    Scratching my head.

  • Has anyone used the ListFieldIterator declaritively with a control mode of New or Edit? The data does not successfully update for me when I do this. Note I'm using FormFields for other list fields and those are successfully updating.

  • I don't know if it's a bug or something but my changes in the Supporting Files tab just won't get saved no matter what I do. I press OK: no go. Apply, OK: no go.

    Any work around so that I can directly tell MOSS to use my custom pages?

  • Hi there,

    I solved the issue with attachments. It's a bit of a drag and requires some thinking, because of the way it works with JavaScript.

    This is the code you need for attachments to work:

    This will display the input field and the buttons as well as what you're trying to upload.

    1) First make sure your field and test case works (Edit form) without the attachments.
    2) What I did was put the attachments in a separate xsl template:

    and then changed the dvt_1 template:


    A few things that are important to remember:

    The JavaScript in SharePoint will look for the objectid part1 in the final HTML and hide the object (display:hidden) and the objectid partattachment and display the object. The partAttachment objectid is automatically generated to the table when you introduce the SharePoint:AttachmentUpload code. The part1 however, you need to introduce yourself.

    Now, if you don't want that anything hides, just put in an empty element somewhere with the id part1{$noop}, otherwise, just use my example for the dvt_1 template (it's neater). The $noop is to fool SharePoint Designer since it will introduce {generate-id()} after the id if you don't specify anything there (to guarantee unique identifiers or something, I don't know) and thus it would fail the javascript since it can't find id=part1, but there will be a part1KLV532.

    You can specify the noop parameter to be empty in the beginning of your xsl stylesheet:

    If this is a little confusing or difficult to read, you can always go to my website:


  • I cannot get my newform.aspx to show. I completed the steps above to insert a custom list form. I keep getting "Invalid page url:". This is driving me crazy. I have recreated a site trying to solve this.....

  • Same thing here about the "Invalid page url:" error.
    Only deleting the old list form and inserting the custom one (not modifying anything in it) is enough to trigger the message.

  • Hi Ustes and Tom, it could be you have not set the custom form as the display page for the list:
    - navigate to your list in sharepoint designer
    - right click and choose properties
    - go to the Supporting files tab
    - choose the content type you want to display your list form for (eg custom list form = item)
    - then browse to set the display page to be the one you've created
    - save. Now your display page should be associated with items in your list.
    Hope this helps! Cheers Adam

  • Hi Adam,

    I have done exactly what you said, and it will not save it. Another thing, If I modify a list (add columns) and use the Custom List Form, I don't get the new columns...

    Tom- My solution was to just modify the NewForm.aspx by adding the controls that I wanted.

  • Correction..When I add a new ASPX page, follow the steps for inserting content and changing the forms that display...PRESTO!!!!!

  • Hey,
    Is it possible to change Save button () behaviour?

    I need to open Edit Form in popup window (for related list management). After save I want to close popup and refresh parent page (using JS).

    Have you any Ideas how to do this?

  • I was trying to add a custom list as mentioned here; however, kept getting an error when clicking "Save" with the insert command. After recreating a test list and adding the fields one by one, I realized that the error occurred when using a field (in my case a date field) with a formula for the default value. Removing the default formula removed the error.

    My question now is, has anyone found a work around for this, and when adding a cutom new/edit form from the list data source and not using the Insert/SharePoint Controls/Custom List Form menu, the "Save" button saves, but doesn't return to the calling page (even with "Source" attribute set in the query string for the page). Can one override the OnCLick="javascript: {ddwrt:GenFireServerEvent('__commit')}" event somehow?

    Hopefully this is clear enough,

  • I just spent an hour getting frustrated that my site was not changing the EditForm to my custom version when I clicked save in the Supported items tab. Others here are complaining about the same thing. The solution is to make sure that you have selected the correct *content type* - it should be "item" if you only have one type.

    Mine defaulted to folder in the drop-down, which ensures that Sharepoint Designer silently fails to make the change. Frustrating UI design, but a correct failure.

  • I have written an event handler to validate a form during the ItemUpdating event. If the user did something invalid, it cancels the update and displays the standard SharePoint error page with a customized message that tells the user specifically what they need to correct. This works great with the default EditForm.aspx, but when I use a custom edit form on the same list a just get an error page with a generic message that says "The data source control failed to execute the update command". It looks like my event handler is doing it's validation and cancelling the update ok, but SharePoint is simply detecting that the event was cancelled and supplying its own (useless) error message. Does anyone know a way around this?

  • Thanks much for this information, its been very helpful.

    A quick question: Anyone tried making multi-page forms for filling out an entry for a list?

  • In the NewForm.aspx file locate the following:

    and add this tag directly after this tag:

    find the following tag:

    and before it add the following tag:

    All the other unmodified forms should work, solution has not been tested on modified Edit or Display forms.

  • Hey Anonymous,

    that doesn't work at all, pls be bit more specific :-D

  • Great article. It got me past a problem so I blogged on the solution myself. :) I was having the same problem Peter Cuttriss and others had where the 'List Preperties' settings wouldn't really save even though they didn't give an error. On a hunch, I changed the "Content type specific forms" setting from 'Folder' to 'Item' and saved. Then everything saved and it's all working great now. Thanks for posting!

  • I've tried both of the solutions that are on here to try and fix the attachment issue on the NewForm.aspx page. Has anyone gotten the attachment buttons to work?

  • HELP! When I attempt to enter a custom list form, nothing happens. I have tried the steps above, tutorials from Microsoft, etc. I create a new page, go to Sharepoint Controls, insert cutom list form, choose the default for the Annoucement lists, and NOTHING HAPPENS. Zip, zilchm, nada.

    ANy thoughts?

  • Mike D, I had tried this months ago and didn't seem to have any problems. I now just tried to do it again on a new site as well as on the site I had done this on before and I also can't get it to work anymore. I select the list, content type, and form type, click OK and nothing happens.

  • Mike D, it must have been some patch from MS. I uninstalled Sharepoint Designer and re-installed and it is now working again.

  • I have created a web user control and trying to add it in a webpage in sharepoint website.

    i have made all the necessary changes in web.config, registered it in aspx page,signed it and placed it in GAC but still get the error.

    I get an error "An error occurred during the processing of /TestPage.aspx. The referenced file '/MyControl.ascx' is not allowed on this page.

    Can anybody please let me know any specific reason and mitigation for it

  • Please display solution to make one column read only for specific users,depending on their user level

  • Good info ... what if when I add the custom list form and it seems like nothing happens? I can remove existing webpart and then add but no activity seems to take place. Am I missing something or not have the right version to do this.


  • Of course I am just wanting to display it - not change it. Thanks.

  • I also experience the "nothing happens" bug when I try to insert a custom list form. Is there windows update available for this? I am doing windows updates now but I didn't see any patch for Sharepoint Designer. I am usinng the trial, does that matter?

  • The Custom List Form solution es great whenever you don't use attachments or program any item event.
    Attachment solution referenced by Evi doesn't work. Looks like some JavaScript code is missing.
    Any time you have a "properties.Cancel = true;" in an ItemUpdating (SPItemEventReceiver) you get an "The data source control failed to execute the update command", the same said by Steve Wigren.
    Finally, ListItemIterator solution looks cool but you loose the toolbar. :(
    Any one got a full working solution?

  • Hi,

    In Custom Form the solution given by Evi does not seem to be working. Anybody had success in solving the attachment problem? If so please tell the solution

  • Hi,

    Anyone fixed the 'Nothing happens' bug when you try and add a custom list form? Im desperate to use this and have searched MS site for updates but no joy.


  • same here... anyone solve the attachment saving issue?

  • Hi All,

    I Updated my EditForm.aspx sucessfully. We can easily do it, u can place heading for different list items, and also u can insert some extra button and anything. Given below is the URL from that u can easily create a custom form for create a new item and edit a item. But make sure that don't delete your bydefault (NewForm.aspx, EditForm.aspx etc.), bcoz if u deleted then u will face the error Invalid page URL msg. Bcoz if u delete the bydefault page then ur custom page is not able to find ur list webparts. U can give any name to ur custom page and u can use it by setting the name in your list folder properties. Check this-- - 93k

  • Very frustrating that customising the simple newform.aspx, editform.aspx changes to display the way we want is so ambiguious,confusing,flaky. I hope MS is watching this and gives a single solution.
    This is what I figured out so far.
    You can change the layout of the newform,editform pages but you will lose the attach file functionaly.I have not able to succesfully be able get the attach file functionality work with a custom layout.
    The key is not to delete the existing webpart but to hide it.

  • Lot's of questions, no answers.

    Jan, unfortunately you seem to not take part in the discussion. May I ask why?

  • Hi All,
    I am using content types in share point list. When I create new entry, First i select content type and create it. But, when I edit then it shows Content Types drop down box on top of the page. Is there any way to disable or hide or remove it.

    Appreciate your help.


  • I followed this to edit a form but found it easier to create a new form but went into sharepoint controls so that it new what list I was creating a form for and everything shows up. The list has a custom column that is a drop down. For some reason when I use this form it doesn't save any selection that I had in the drop down but the field is also not a required field. All code appears correct. What should I check for?

  • I want to add code to the SaveButton on the editform.aspx. How do i do that?

  • Hi Jan

    I need a different solution similar to your blog. I have all the list fields in my custom list page and in addition to that i have added two more text boxes. Those addtional control info is should be saved in different list. Guide me how to achieve this


  • Hi friends,
    Had anybody broke through "AttachFile" problem in customized list.Help me if anybody did.
    Have a nice day.Thanks.

  • This was so helpful, thanks for being!

  • Cant' move focus to the control because it is invisible, not enabled or of a type that does not accept the foucs

  • when clicking on Attachfile button its getting error :

    " Cant' move focus to the control because it is invisible, not enabled or of a type that does not accept the foucs"

  • is there any way to make the Body field (a list form field) expandable? It is too squished and we want to widen it out. How would I go about doing this?

  • Solved the problem for displaying attachments in a custom display form.

    Simply add a new row in the custom display form and add the following line within that row in the code view.

  • What is the best way to validate these forms.

  • Hi Ahshad,

    Attachments are not saving to the list.

  • Hi,
    Iam not able to save attachments to customised Newform.If anybody have a solution please help me.....
    Have a nice day......

  • With all the trials and tribulations posted here I am surprised I am the only one with this problem:

    I created new create, edit and display forms for a calendar list (I didn't shoot myself in the foot and delete the old ones - that's a bad idea, isn't it). This was so I could hide the row with "create workspace" in it.

    The create form seems to work fine, but the the edit and display forms always show the first record in the list.

  • I'm having the same problem as Jerry. Any help would be appricated. I was able to expand single and multiple text field by modifiying the core.css. Also is there any way to increase the size of the area that displays the field descriptions?

    is there any way to make the Body field (a list form field) expandable? It is too squished and we want to widen it out. How would I go about doing this?

  • I'm having the same problem as Jerry. Any help would be appricated. I was able to expand single and multiple text field by modifiying the core.css. Also is there any way to increase the size of the area that displays the field descriptions?

    is there any way to make the Body field (a list form field) expandable? It is too squished and we want to widen it out. How would I go about doing this?

  • I am having the same problem as Jerry. I would like to increase the size of the boxes, 143x129 is not cutting it. I was able to increase the display size of single and multiple line text boxes by modifying the core.css file.

    # re: Custom Edit Forms for SharePoint 2007 Lists
    Wednesday, September 12, 2007 11:38 AM by Jerry

    is there any way to make the Body field (a list form field) expandable? It is too squished and we want to widen it out. How would I go about doing this?

  • This was a great article, and I've been trying to use it on my Survey, but every time I customize that web part, I completely lose all of the branching logic that was built in. Has anyone tried this approach with a survey that has branching?

  • Using SharePoint Portal Designer I have copied NewForm to MyNewForm and then updated the MyNewForm.

    I then went to the properties of the list in Sharepoint Designer, Supporting Files tab and changed The New Item Form to MyNewForm.

    When I browse to the list and click New i get a alert box stating "Invalid Page URL:"

    Any help will be appreciated

    Richard Martins

  • Hi Jan,
    Can you please elaborate how to do this in WSS 2 with FP 2003?
    Thanks a lot in advance

  • Has anybody found a solution for the "nothing happens" issue when inserting a custom list form? I see quite a few posts on a number of blogs by people hitting this wall, but no solutions.

    I have tried re-installing, upgrading from a trial version, etc. but still nothing.

    Does anonymous access need to be set up (similiar to the XML web part issue)?

    Seems like this should "just work" and I am not alone in having this problem.

    Thanks in advance!

  • I love you.
    I love you with all my heart.

Comments have been disabled for this content.