Ask a questionAsk a question
 

AnswerDisable fields in EditForm.aspx

  • Thursday, November 05, 2009 9:48 PMDavidLewis27 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have been diabling a few fields in  EditForm.aspx.  The way I have been doing this is by setting the control mode = display.  this thoughs an error if I do it for a date picker.  Can anyone tell me the easiest way to disable a date field for editForm.aspx

Answers

All Replies

  • Thursday, November 05, 2009 11:16 PMCoreyRoth Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    If the list is custom and you are building it with a feature, you can set the ShowInEditForm attribute to false on each field that you do not want to show up.  This will prevent the field from showing up when the edit form is sdisplayed without having to change the form itself.
    Corey Roth blog: www.dotnetmafia.com twitter: twitter.com/coreyroth
  • Friday, November 06, 2009 4:20 AMLauraRogers Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Well, if you simply want to hide fields, this can be done without cracking open sharepoint designer or doing any code.

    You have to enable content types in that list or library first.  In the list/ library's settings, click "advanced settings"
    Change the very first box "allow management of content types" to YES

    Then, you'll have a new section in your list's settings, called "content types".  You can then click the name of the content type in there, and then click on a field name and change it to hidden.

    Laura Rogers, MCSE, MCTS
    SharePoint911: SharePoint Consulting
    Blog: http://www.sharepoint911.com/blogs/laura
    Twitter: WonderLaura
  • Friday, November 06, 2009 6:17 AMGanesh Jat Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    You can do it by using Sharepoint designer.   either make the field control disable using javascript code or use a custom edit form and render the field as label.
  • Sunday, November 08, 2009 8:28 AMGuYumingMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    A workaround is that instead of setting the control mode = display, your can format the field as datetime (instead of list form field).
  • Tuesday, November 10, 2009 6:20 PMDavidLewis27 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I dont think I am either writing the javascript correctly because I cant seem to get it to work.  Do you possibly have an example?