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 am trying to hide the Title field so it does not appear in add/edit forms. I am using web templates. The title is hidden in the sitecollection but not in any of its sub sites.

Below is my code.

SPFieldText fieldTitle = (SPFieldText)(newList.Fields[SPBuiltInFieldId.Title]);

fieldTitle.Hidden = true;

fieldTitle.Update();

Please remember this worked fine in the sitecollection but not in the subsite created.

share|improve this question
add comment

3 Answers 3

up vote 1 down vote accepted

You could try this:

var titleField = newList.Fields[SPBuiltInFieldId.Title];
titleField.ShowInEditForm = false;
titleField.ShowInNewForm = false;
titleField.Update();
share|improve this answer
    
does not work. any other ideas? –  user1786107 Nov 9 '12 at 15:13
    
That would be my only suggestion, as I ran and verified that it worked before I posted it here :) But I only tested on a normal SPList, which is probably not what you are looking for at all. –  eirikb Nov 9 '12 at 15:22
add comment

Try to set it as ReadOnly field. It works when you set it in Schema.xml.

var myList = web.Lists["myList"];
var titleField = myList.Fields[SPBuiltInFieldId.Title];
titleField.ReadOnlyField = true;
titleField.Update();

Should be invisible in edit and new form.

share|improve this answer
add comment

When I don't need Title field, I usually just use it for other purposes, if I have any other single line fields on the form. You can rename Title field with SharePoint Designer and use it for other purposes. Also I don't think, that it is best idea to hide it, because when you will use table view of list there will not be option for editing with context menu and direct link to item if you will work without title. So, my advice to stay it, but use for another purposes. Another way I do, just hide it by javascript on the form, and insert by the same javascript some information to the Title field for correct displaying on the list table view.

share|improve this answer
add comment

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.