Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I created a new list on my site for collecting issues/incidents. I customized columns and I included two that are relevant for developer, but not for testers:

  • Status - used to change from pending/active/resolved/closed/deferred
  • Developer comment - used for developers when setting a particular incident to closed or deferred

When users try to add a new issue a form is presented to them (basically I'm presenting the form in a modal window). but Status and Developer comment fields are also displayed.

Is it possible that I hide these two fields in the new item form?

share|improve this question

9 Answers 9

Yes, and you can do this in C# code or in CAML:

<Field Type="URL" 
DisplayName="MyUrl" 
Required="FALSE" 
EnforceUniqueValues="FALSE" 
Indexed="FALSE" 
Format="Hyperlink" 
Group="Custom" 
ID="{24e6ce71-9004-41aa-b188-ed84e6cdc103}" 
SourceID="http://schemas.microsoft.com/sharepoint/v3" 
StaticName="MyUrl" 
Name="MyUrl" 
AllowDeletion="FALSE" 
ShowInEditForm ="FALSE" 
ShowInListSettings="TRUE" 
ShowInNewForm ="FALSE" 
ShowInDisplayForm ="TRUE" 
ShowInViewForms ="TRUE" 
ShowInFileDlg ="FALSE" 
ShowInVersionHistory="FALSE"></Field>

You can also set the field to be hidden with the "Hidden" attribute, but if you want to change this through code later (to unhide the field) you'll need to set "CanToggleHidden='TRUE'" too. See this for more details.

To set these values in C#:

SPField f = ...
f.ShowInNewForm = false;
f.Update();

Just choose the appropriate property.

share|improve this answer

There is a tool called SharePoint Manager 2010. There is also a version for SharePoint 2007. With this tool you can alter all kind of properties of SharePoint.

Take a look at it it is very usefull.

http://spm.codeplex.com/

share|improve this answer

The best solution for that comes from Laura Rogers --> Displaying SharePoint Fields by Permission Level

Here is the abbreviated version:

You can show/hide fields in a SharePoint Form by setting the conditional formattings with SharePoint Designer. Just open the webform (e.g. NewForm.aspx) and switch to advanced mode. Then choose the field you want to hide for specific user group and create a new condition criteria... click advanced and paste "ddwrt:IfHasRights(16)" (without quotes) in the field "Edit the XPath Expression".

This is it. Now only users with approval rights can see that field.

share|improve this answer

If you provisioned this list in code, each of the fields has a "ShowInNewForm" and ShowInEditForm proprties which can be set to "false" to hide from these forms.

I think these properties can only be set in code, so if you havn't created the lists from code, you'll need some code to do set these properties.

If you're using SharePoint Server 2010 you can hide the fields using InfoPath.

Otherwise, you may try to edit the new/edit forms using SharePoint Designer

share|improve this answer
    
1.) Not created in code 2.) editing the form in Designer doesn't allow editing the web part that actually displays the form. Editing is only possible for other parts. –  Robert Koritnik Jan 10 '11 at 13:49
    
View Rob's answer for doing it with SPDesigner. –  James Love Jan 10 '11 at 14:18

You can do this with SharePoint Designer. You need to create a new site page, then use the insert new or edit form buttons at the top to insert a Data View Web Part. Using this method you'll see a button on the ribbon that allows you to add/remove particular columns on the form.

A second approach is to use the default forms but use jQuery to hide the fields. The names are system generated so it will take a little digging.

share|improve this answer
1  
If you want to use JavaScript to hide the fields, I would suggest taking a look at my library SPUtility.js: sputility.codeplex.com. I think it may work in SharePoint 2010 or at least give you an idea. –  Kit Menke Jan 10 '11 at 14:22
    
Kit-Your project looks great. That's a nice idea, and timely. Is the code based on the field labels? I'll be keeping an eye on it! –  Rob Wilson Jan 10 '11 at 14:44
    
Thanks Rob. :) The code is based on the field labels and then creates little JavaScript "classes" based on the field type. –  Kit Menke Jan 10 '11 at 16:50

I have recently built a tool that will allow you to configure the ShowInNewForm property using the standard administration screens.

http://spc3.codeplex.com/wikipage?title=ShowHideFields

  1. Install the solution
  2. Navigate to the list
  3. Set the NewForm field to be No
  4. Save

Or you can do it with powershell quickly

$list = (Get-SPWeb "http://yoursite").Lists |? {$_.Title -eq "yourlist"}
$field = $list.Fields["yourfield"]
$field.ShowInNewForm = $false
$field.Update()
share|improve this answer

I have used a tool called MOSS Show/Hide Fields (http://spiralout.codeplex.com/releases/view/22305). It runs on the client and lets you hide fields from moss forms (new,edit,display,view). It was built for SharePoint 2007, but I just tried it with SharePoint 2010 and it worked in my simple test.

share|improve this answer

You can hide hide a field in Sharepoitn Designer by setting the visibility for both 'ms-formlabel' and 'ms-formbody' to 'hidden.

For example:

<td width="190px" valign="top" class="ms-formlabel" style="visibility: hidden">
.
.
</td>
<td width="400px" valign="top" class="ms-formbody" style="visibility: hidden">
.
.
</td>

This hides the field and label form the form however, it will nto submit any data to the list for that field.

share|improve this answer
    
Sorry for the spelling mistakes :P –  Mark Dininio Feb 8 '13 at 15:46

Yes.Go to the list settings then you can enable the manage content types ON then select the Item content type then select the corresponding columns and make as Hide from the options.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.