The SharePoint Engie that could…

Stories from a SharePoint Engineer that isn't afraid of Visual Studio.

How to edit the form fields of a SharePoint List

with 61 comments

Here’s an often forgotten feature that any SharePoint Designer person should be aware of. It’s the ability to edit and customize the default form fields for any list. This is made possible by using SharePoint Designer to navigate and open the form page that you want to edit. When you open the page you’ll see something like this:

You’ve probably tried right clicking around, trying to convert the web part to a dataview web part, and then you threw up your hands and said this is impossible!

But wait! Check this out… First select the ListFormWebPart and *EDIT: DO NOT hit the delete key. Instead hide the webpart. If you delete it, this will happen: http://support.microsoft.com/kb/935504

Ta da! Now you can go about your daily business of form customizations.

Written by Henry

September 5, 2007 at 8:55 am

61 Responses

Subscribe to comments with RSS.

  1. Hi there
    When i remove the title filed i get Error When i creat a new item?
    And if any one know about removing the tiltle filed from list

    thanks

    Hilina

    September 5, 2007 at 11:25 pm

  2. I’ve noticed similar errors also but haven’t had a chance to figure out why. instead, i’ve used custom css to hide the fields i didn’t want instead of deleting it.

    Henry

    September 6, 2007 at 7:24 am

  3. You”ll probably want to modify the content type for the list and use ShowInDisplayForm (or ShowInEditForm) to toggle the display.

    Oskar Austegard

    September 6, 2007 at 11:39 am

  4. Thanks for the tip Oskar, but I’m a bit confused. Where would we be able to find the ShowInDisplayForm property?

    Henry

    September 6, 2007 at 12:46 pm

  5. i can’t click SharePoint controls..how?thnx

    anne

    September 17, 2007 at 11:04 pm

  6. You mean SharePoint Controls from the menu? Have you tried clicking onto a web part zone on the page before that?

    Henry

    September 18, 2007 at 7:52 am

  7. sorry..can u explain to me step by step..i want to edit my list..thnx!

    anne

    September 18, 2007 at 4:27 pm

  8. hey anne,

    make the List Form Web Part invisible. (if you still get the error, you have to recreate the list first)

    put your custom list form inside.

    after that, simply open the web part options and activate the “Hidden” option. thats all

    bacco

    October 18, 2007 at 2:31 am

  9. Hello.

    I have a question regarding hidden fields. Is it possible to have fields (on a SharePoint list form) that are hidden or shown based on the selection made in another drop-down field? Or maybe a hidden sub-form?

    I’ve been looking for a week for an answer to this all over the web, and I can’t seem to find it. Thanks!

    Vlad

    October 30, 2007 at 3:36 pm

    • Did you got the answer for this?
      If so please share

      muralee

      May 20, 2009 at 7:12 am

  10. i’m thinking some custom javascript on one of the form pages should do the trick.

    Henry

    October 30, 2007 at 10:24 pm

  11. Henry, thanks for the quick answer. Have you seen anything like that out there? If I see it, I may be able to duplicate it. Any thoughts? Thanks again.

    Vlad

    October 31, 2007 at 7:35 am

  12. Hello,

    I am trying what you are saying, however I am still unable to use the Attachment button. I am getting a javascript error stating the the control is not available because it is hidden.

    If this is the case then why not create a new form and import the custom list for into that? It does the same thing and you dont even have to touch the newform.aspx form.

    Thanks for any help

    Andrew

    January 18, 2008 at 2:45 pm

    • Hi,

      I am having the same issue with the attach button. Does anyone know how to restore the attach functionality in a modified custom form?

      Sandy

      June 18, 2009 at 9:35 am

      • Hey Sandy, I vaguely remember seeing this fix introduced with SP2.

        Henry

        June 18, 2009 at 3:48 pm

  13. in the above thing i need to make some feilds as read only is ther any posibility in doing this

    uday

    March 26, 2008 at 6:15 am

    • Uday,we can make the form field read only using javascript on the page load…

      _spBodyOnLoadFunctionNames.push(“makeReadOnly()”);

      function makeReadOnly()
      {
      document.getElementById(‘ctl00_PlaceHolderMain_g_99d476b6_6f5b_487c_9498_d9029f585497_ff11_1_ctl00_ctl00_TextField’).disabled = true;

      //document.getElementById(‘ctl00_PlaceHolderMain_g_99d476b6_6f5b_487c_9498_d9029f585497_ff11_1_ctl00_ctl00_TextField’).readOnly=”readonly”;
      }

      .
      .
      .
      Check it out

      Samarendra Swain

      September 8, 2009 at 12:00 am

  14. uday, after you have created your custom form, individually format the “read only” form field as “text” or “rich text” instead of as a list form item.

    ros256

    April 23, 2008 at 12:04 pm

  15. Hi,
    is very useful. But one of my design problems thereby becomes not solved. On a wiki-site the option New Item Form is disabled. And just this I need. Is there an other possibility to do this? Thanks.

    Tobia

    May 8, 2008 at 12:29 am

  16. Hey Tobia, I’ve also looked into doing this but haven’t found an easy option to edit wiki new form pages.

    Henry

    May 12, 2008 at 7:46 pm

  17. Hi –

    Thanks – I followed the instructions and customized my NewForm. But when I try to load it, I get an error. Any ideas? :)
    ” Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator. “

    Tuesday

    May 15, 2008 at 7:06 am

  18. how do you ‘HIDE” the webpart in sharepoint designer?

    dhx

    May 28, 2008 at 3:20 pm

  19. Hey dhx, you can right click the web part, click on web part properties and then mark it hidden (one of the check boxes in the settings)

    Henry

    June 2, 2008 at 6:56 pm

  20. Thanks alot for this articale ,and i have a question … in looding this page in your example and set the value of emplyee name automatic so i made this input field disabled by javascript but the sharepoint consider this field is empty ???? meaning , when i make the field disabled sharepoint consider it as empty field any idea ???

    Qassem

    July 1, 2008 at 5:57 am

  21. I have tried the steps listed. However, when I try to insert a custom list, it does nothing. I don’t get an error message or anything. I am trying to edit the newform.aspx.

    Any ideas?

    Georgia

    July 11, 2008 at 7:26 am

  22. Hey Georgia, are you inserting the custom list into a web part zone?

    Henry

    July 12, 2008 at 3:56 pm

  23. Folks, I am trying to mark a field as readonly so the user will not be able to edit it. The field is already populated. Thx

    Catalin

    July 13, 2008 at 7:31 am

  24. Does anyone have any idea how to layout a radio button group for a Choice field in SharePoint so it displays horizontal rather than vertical.

    Dave

    July 20, 2008 at 8:03 pm

  25. hi,
    i did the following steps to get the custom lis form for a custom list i hvae created
    1.Hide the default List Form Web Part from the page.
    2.Go Insert > SharePoint Controls > Custom List Form.
    3.In the List or Document Library Form dialog, select the appropriate list, content type and type of form.
    4. Click OK and a new Data Form Web Part is not added , no error on the page also there is no error in the log files

    shekhar

    August 28, 2008 at 4:10 am

  26. Hi,
    I have a strange behavior.
    When I try to 1-Hide the default List Form Web Part from the page in the small windows I don’t have the control where you can click hide and all the other stuff but I have the page that get display. I try it on an other list and it work but the list I need to change doesn’t.
    On the same list when I tried
    2.Go Insert > SharePoint Controls > Custom List Form.
    3.In the List or Document Library Form dialog, select the appropriate list
    Nothing display in the window with no error but I try the same thing on an other list it work.

    How can I fix my list to be able to create custom page to add, edit and display my data ?

    Thanks,
    Eric

    Eric

    September 2, 2008 at 12:06 pm

  27. Thanks for this posting. I am using and it does exactly what I wanted and it is easy to do.

    I have one question someone might be able to help with. I am using this technique to create a custom display form. In my DispForm, I have a field that is a multi-select people field. It is displaying the HTML code instead of rendering it. How do I need to configure that field so it renders the HTML properly?

    Rich R

    October 24, 2008 at 6:14 am

  28. I answered my own question in case anyone else stumbles across this.

    The display field needs to contain ‘disable-output-escaping=”yes”‘.

    Example:

    Rich R

    October 24, 2008 at 11:45 am

  29. Example in last comment should be as follows within the tags for the field to be displayed:

    xsl:value-of select=”@FieldName_x0020″ disable-output-escaping=”yes”/

    Rich R

    October 24, 2008 at 11:47 am

  30. well, hi admin adn people nice forum indeed. how’s life? hope it’s introduce branch ;)

    cwxwwwxdfvwwxwx

    December 25, 2008 at 4:19 pm

  31. I’m having the same problem as someone mentioned before. I’m trying to insert a New Item Custom List Form on a dispform.aspx of another list. Data Views and List Forms work fine inserting them in the display form, but when I try to insert the New Item Custom List form it is displayed in Sharepoint Designer but not in the browser… I get the following error:
    “Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.”

    Not really informative…. I thought it would be something with the Data Source and the GUIDs but everything seems to be OK…

    Daniel

    February 25, 2009 at 1:31 pm

  32. Hello Henry,

    Enjoyed the site and information you have displayed. I do have one question if I may.
    Have you had any luck editing the Master pages, such as People and Groups? I want to add more fields to these poeple and groups as well as be able to sort like a list by department? If this cannot be done, then how about I like Active Directory from a list so it can populate the name, department and title and I can pull in pictures of their ugly mugs. What do you think Henry? Any ideas.
    Also, the trip to Korea blog was most interesting. Never been there myself though. Would like to bike ride across the country perhaps.

    Thanks
    Clayton

    Clayton Hailey

    March 24, 2009 at 10:30 am

    • How come you don’t answer your cell phone anymore? ARe you still alive?

      M

      November 16, 2009 at 1:33 pm

  33. Hi,

    Good information!
    I have used the same method for custom list edit & new forms.
    I have strange problem when I have a column of type spuser with people picker control the check names button does not function.

    Any info will be helpful!!!
    Thanks,

    ms

    April 1, 2009 at 10:21 am

  34. Hi,

    I’d like to know how to control the date & time validation on the web?

    thx
    Wong

    Hi

    April 2, 2009 at 6:12 pm

  35. Hey Wong,you can probably use a custom event receiver to check for validation.

    Henry

    April 2, 2009 at 8:32 pm

  36. Thx Henry

    Basically, the javascript as below can only handle the date validation. But, it cannot handle date and time validation in SP.

    function PreSaveAction()
    {
    var date1 = getTagFromIdentifierAndTitle(“INPUT”,”DateTimeFieldDate”,”Start Date”);
    var date2 = getTagFromIdentifierAndTitle(“INPUT”,”DateTimeFieldDate”,”End Date”);
    var arrDate1 = date1.value.split(“/”);
    var useDate1 = new Date(arrDate1[2], arrDate1[1]-1, arrDate1[0]);
    var arrDate2 = date2.value.split(“/”);
    var useDate2 = new Date(arrDate2[2], arrDate2[1]-1, arrDate2[0]);
    if(useDate1 > useDate2)
    {
    alert(“The End Date cannot happen earlier than the Start Date”);
    return false; // Cancel the item save process
    }
    return true; // OK to proceed with the save item
    }
    function getTagFromIdentifierAndTitle(tagName, identifier, title) {
    var len = identifier.length;
    var tags = document.getElementsByTagName(tagName);
    for (var i=0; i < tags.length; i++) {
    var tempString = tags[i].id;
    if (tags[i].title == title && (identifier==”"||tempString.indexOf(identifier)==tempString.length-len)) {
    return tags[i];
    }
    }
    return null;
    }

    Wong

    April 3, 2009 at 12:51 am

  37. I’ve created a custom list form. Now I’ve added new fields to the actual list. Anyone know how to go about displaying/adding these new fields to my custom list form?

    Al

    April 6, 2009 at 12:17 pm

  38. Hey Al, you should be able to add the new fields by dragging it in from the list’s data source.

    Henry

    April 7, 2009 at 8:37 pm

  39. Hello Henry,

    I will be very grateful if you can help me on this one. I have had a look at your guide and i cant get it too work. When i click “Custom List Form”, i then select the list or library i require. When i click okay (to import a new item form) … NOTHING HAPPENS. Sharepoint designer doesnt render anything. I have tried allocating a web part zone, everything. It just seems to ignore the command.

    Any ideas ?

    Empers

    April 16, 2009 at 10:14 am

  40. I used Sharepoint Designer and did the follwing
    -Create a new ASPX page
    -Insert Sharepoint Control
    -Choose Custom List Form…
    -Pick my custom task list and the content type and click OK.

    But after this, nothing happened. I mean no code(columns of fields)has been inserted.
    Another strange thing is when I open the default edit form aspx for my custom task list, it only shows three genric columns with names such as Name1, Name2, etc. It is totally different from when I run this edit form from IE or Firefox(in which all the columns shown as I expected).
    Please let me know why this happened? What might I miss?

    thanks
    xiaoxiao

    Xiaoxiao

    April 30, 2009 at 11:33 am

  41. Hi Steve,

    Iam using custom aspx form(developed in vs.net) in content types for edit/desplay. When i edit the list item the form will open but the form fields are not getting binded.

    How to bind the form fields when a item is edited

    Thanks,
    Pravyn

    praveen

    May 20, 2009 at 11:09 pm

  42. When editing my form (newform.aspx) in sp designer 2007, I always seem to get the Invalid page URL error even if I don’t make changes to the form. This is exactly what I did, luckily I saved the list as a template to resurrect it when things went bad:
    -Open newform.aspx
    -Hide listformwebpart (double click, check hide)
    -Hit escape (or else the insert menu is greyed out)
    -Active area is now the “placeholdermain custom”
    -Insert > SP Control > Custom List Form
    -Selected Event & New Form
    -Form data now displays correctly.
    -Clicked SAVE (note, no changes except for inserting the custom list form)
    -Got the message: Site Definition Page Warning – Saving your changes will customize a page from the “site definition. Are you sure you want to do this?”
    -I have to click YES or else it won’t save.
    -Checked my list in the browser and clicked NEW = Invalid page URL error.

    Pls help… I’ve recreated this list over 20 times trying different things and it always seems to break. Any help is much appreciated!

    lee

    May 22, 2009 at 11:07 am

  43. Soooooo after about 20 tries/rebuilds, I figured out the fix. I’m posting this in hopes I can save someone from ripping their hair out.
    Before you try this, please save your list as a template with “save content” checked. I’m 99.9% sure this will work for everyone, but I’m not responsible for any data loss!
    -In Designer, create a copy (or copies) of the forms you’re trying to edit.
    -Open up the copy (I’ll use newform in this example)
    -Click on listformwebpart
    -Delete the damn thing
    -Follow the instructions above to Insert a new control (you should be within the Main placeholder)
    -Make your changes
    -SAVE the copy
    -Right click on the list in the Folder View > Properties and click on the Supporting Files tab.
    -Point “New item form” to the copy you’ve edited and saved.
    -Hit Apply.
    -Test & relax!

    btw, another thing came up, I’m trying to rearrange the order of the form, but some of the fields can’t be cut/pasted. Help?

    lee

    May 22, 2009 at 11:27 am

    • Can’t get the new url to stick. No matter what, it points back to the original file!!! Geez..

      m@

      November 20, 2009 at 10:21 pm

  44. Microsoft has made the sharepointdesigner 2007 free to download down. I downloaded it with great hopes, but I gues there is only so much available in this free software. I tried adding custom list form but it is grayed out. No matter how I do it, where I click, it is greyed out. Do you have any idea if this is one thing that is not available in the free software.

    curious

    June 5, 2009 at 2:37 pm

    • follow the instructions I left above, namely: -Follow the instructions above to Insert a new control [BOLD](you should be within the Main placeholder)[END BOLD]

      lee

      June 5, 2009 at 2:39 pm

  45. We have a custom list that we created, the list has several columns but would like to only display a subset of those columns to the user and then the full columns be made available to the list owner. I found a way to hide the columns but it hides them for everyone, is there anyway for a site admin or someone to see the full set of columns even though hidden? I cannot find a way to do this. I guess I do not see the benefit of offering a hidden column if no one can ever access it. Seems like should be able to hide from some but not all. Anyone ever run into this issue? Am I missing the obvious? Any help would be apprecated. PS I am new to the MOSS environment.

    Patti Teehan

    June 15, 2009 at 12:15 pm

  46. More in a moment on the Travertine Question. ,

    Bob18

    October 10, 2009 at 8:12 am

  47. Patti,

    Have look at this site:http://www.infoq.com/articles/Dressel-Gogolowicz-wss-security

    You can download the code/feature here:
    http://code.msdn.microsoft.com/SecureField/Release/ProjectReleases.aspx?ReleaseId=1170

    Nishan

    November 11, 2009 at 5:44 pm

  48. Will it reflect the columns if i add it newly??

    chanakya01

    November 19, 2009 at 4:12 am

  49. No matter what I do… I can’t change the new list form of the supporting files tab. Even when I change the name it sticks to the new name… freaking dumb.

    m@

    November 20, 2009 at 10:15 pm

    • When you are changing the default files of a sharepoint list, the menu comes up showing each form (New, Edit, Display) there is a dropdown box that comes up initially as “Folder” much of the time. You must make sure that says “Item”. The “folder” setting will always seem to complete successfully, but no change will be recorded. I think this is a feature, not a bug.. lol

      ITCowboy

      December 14, 2009 at 2:51 pm

  50. I’m feeling a bit frustrated as I’ve done everything I can think of but I still CANNOT hide the web part in designer. When I right-click and select Web Part Properties I get the following error:

    “Operation is not valid due to the current state of the object”

    Any suggestions? Please?

    Erica

    March 1, 2010 at 9:56 am

  51. Well after searching and trying multiple things I finally got it to work by tweaking the code.

    false

    I changed the code from true to false for the WebPart.

    Erica

    March 1, 2010 at 11:44 am

  52. The code was zapped when I posted it so here it is again:

    “false”

    I changed the code from true to false for the WebPart and the web part is now hidden.

    Erica

    March 1, 2010 at 11:46 am

  53. ==false

    Erica

    March 1, 2010 at 11:47 am


Leave a Reply