Ask a questionAsk a question
 

AnswerHow do I hide a column in a custom list (edit and new forms)?

  • Thursday, November 05, 2009 11:13 PMrun4it Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I want to have a column that by default is today's date.  But I do not want it to show in the new or edit forms.  Is there a way to do this?  I want it to use for a calculation in a view, but I do not need the user to ever see it.

Answers

  • Saturday, November 07, 2009 6:46 AMPeter Holpar Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Shivannarayana,

    "My question first, have you created a separate column to show the today's date?. If yes, you dont have to create it,you have in built column created for you.  This is created read only and which will not be shown when in the new or edit form."

    I don't know which field do you mean here, but if you mean the Created field, it will show Today only the day the item was created. The next day it will show Yesterday. :-)

    If you create a calculated field having Today in it, it won't be updated each day, unless you go there (from the UI or from code) and update the item.

    Corey Roth,

    "If you are creating your custom list using a feature, you can edit the Field element in the CAML for the particular fields you do not want to show.  You can add ShowInEditForm and ShowInNewForm attributes and set the value to false to prevent those fields from showing up on your forms."

    One can set these properties on an existing filed (or just when adding the field) from code too, so the field can be hidden as requested in the original request.

    Peter

All Replies

  • Thursday, November 05, 2009 11:25 PMCoreyRoth Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    If you are creating your custom list using a feature, you can edit the Field element in the CAML for the particular fields you do not want to show.  You can add ShowInEditForm and ShowInNewForm attributes and set the value to false to prevent those fields from showing up on your forms.
    Corey Roth blog: www.dotnetmafia.com twitter: twitter.com/coreyroth
  • Friday, November 06, 2009 6:14 AMGanesh Jat Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    You can do it by setting the field as hidden in Content type setting page . Go to Advance setting -> enable content type editing on site setting page
    • Proposed As Answer byshiva.g Friday, November 06, 2009 6:36 AM
    •  
  • Friday, November 06, 2009 6:36 AMshiva.g Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    Hi,

    My question first, have you created a separate column to show the today's date?. If yes, you dont have to create it,you have in built column created for you.  This is created read only and which will not be shown when in the new or edit form.


    Hope this helps you .

    Thanks,
    Shivannarayana.
    • Proposed As Answer byshiva.g Friday, November 06, 2009 6:36 AM
    •  
  • Friday, November 06, 2009 7:47 PMrun4it Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I did finally notice at I could do a sort on a date column and compare it to [Today]. 
  • Saturday, November 07, 2009 6:46 AMPeter Holpar Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Shivannarayana,

    "My question first, have you created a separate column to show the today's date?. If yes, you dont have to create it,you have in built column created for you.  This is created read only and which will not be shown when in the new or edit form."

    I don't know which field do you mean here, but if you mean the Created field, it will show Today only the day the item was created. The next day it will show Yesterday. :-)

    If you create a calculated field having Today in it, it won't be updated each day, unless you go there (from the UI or from code) and update the item.

    Corey Roth,

    "If you are creating your custom list using a feature, you can edit the Field element in the CAML for the particular fields you do not want to show.  You can add ShowInEditForm and ShowInNewForm attributes and set the value to false to prevent those fields from showing up on your forms."

    One can set these properties on an existing filed (or just when adding the field) from code too, so the field can be hidden as requested in the original request.

    Peter