0

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.

2
  • 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? Apr 30, 2012 at 11:19
  • @spevilgenius I've edited my question.
    – MOI
    Apr 30, 2012 at 11:23

2 Answers 2

0

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

3
  • do you know how to hide this field?
    – MOI
    May 24, 2012 at 13:49
  • Yea, edit the content type and change the field to be hidden from required or optional. May 24, 2012 at 19:29
  • 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. May 29, 2012 at 17:07
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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