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've created a contentype that inherits from the item contenttype. So the contenttype automaticaly has the field: Title.

But how access this field (I want to add some custom validation and define if it is shown in editform)?

Thanks a lot!

Edit: I want to do serverside validation and use the custom edititemform. Perhabs there is a possibility to delete this field?

Edit:

I've tried to change the content type like this:

  <Field
  ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"
  Name="Title"
  StaticName="Title"
  DisplayName="Title"
  Type="Text"
  FromBaseType="TRUE"
  Required="FALSE"
  Hidden="TRUE"
  SourceID="http://schemas.microsoft.com/sharepoint/v3"
/>



  <!-- Parent ContentType: Element (0x01) -->
  <ContentType ID="0x0100b48c62c42879472aa8f1e1afc4dba7ce"
               Name="aa- aa"               
               Group="Custom Content Types"
               Description="My Content Type"
               Inherits="TRUE"
               Version="0">
      <FieldRefs>
        <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Hidden="TRUE" Required="FALSE" />

      </FieldRefs>

But the title field is still required and shown.

share|improve this question
    
What type of validation are you looking for? Is this going to be server side validation or client side? How do you want to edit the form? –  spevilgenius Apr 30 '12 at 11:19
    
@spevilgenius I've edited my question. –  MOI Apr 30 '12 at 11:23

2 Answers 2

I'm not sure you can delete the field, but you can make it hidden in your content type settings.

share|improve this answer
    
do you know how to hide this field? –  MOI May 24 '12 at 13:49
    
Yea, edit the content type and change the field to be hidden from required or optional. –  Steve Lineberry May 24 '12 at 19:29
    
I've edited my question. Thanks a lot! –  MOI May 29 '12 at 7:26
    
Oh, i was saying to edit it in the browser. I'm not sure how to do it through a custom content type defined in xml. You could probably do it through some code though. –  Steve Lineberry May 29 '12 at 17:07
up vote 0 down vote accepted

I found the problem:

If I want to hide to remove the title collumn in my contenttype I have to disable the contenttypes inharitation. But after disabeling the inharitation the custom collumns will disapear after deployment. Because they are not part of the base type. SO the fields have to be declared in the list schema too.

MSDN

When SharePoint Foundation creates a list instance, it includes only those columns that are declared in the base type schema of the list or in the list schema. If you reference a site content type in the list schema, and that content type references site columns that are not included in the base type schema of the list or in the list schema, those columns are not included. You must declare those columns in the list schema for SharePoint Foundation to include them on the list.

Contenttype

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field ID="{61CC6776-F855-48d5-A4EC-B7CE11CE2324}"
      DisplayName="ExpiresDate" Name="ExpiresDate"
      Type="DateTime" Required="False"
      UnlimitedLengthInDocumentLibrary="FALSE"/>


  <!-- Parent ContentType: Element (0x01) -->
  <ContentType ID="0x0100b48c62c42879472aa8f1e1afc4dba7ce"
               Name="GroupsList - ContentTypeGroups"               
               Group="Custom Content Types"
               Description="My Content Type"
               Inherits="false"
               Version="0">
      <FieldRefs>
        <RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" />

      <FieldRef ID="{61CC6776-F855-48d5-A4EC-B7CE11CE2324}" Name="ExpiresDate" Required="FALSE" ShowInNewForm="FALSE" ShowInEditForm="FALSE" />
      </FieldRefs>
  </ContentType>
</Elements>

List Schema

...

  <ContentTypes>

      <ContentTypeRef ID="0x0100b48c62c42879472aa8f1e1afc4dba7ce" />
    </ContentTypes>
    <Fields>
      <Field ID="{61CC6776-F855-48d5-A4EC-B7CE11CE2324}"
          DisplayName="ExpiresDate" Name="ExpiresDate"
          Type="DateTime" Required="False"
          UnlimitedLengthInDocumentLibrary="FALSE"/>

    </Fields>
...
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.