3

I have created a custom content type and I would like to have all lists that use that content type use it's edit/new forms. Below is the XML i have in my Elements.xml file:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ContentType ID="0x0100211ACDF9A8F75C4190D46F1ADCF5015604308633d0aadc3f41809a6430a81fe0151b"
               Name="TestContentType - TestContentType"
               Group="Custom Content Types"
               Description="This is a test.  This is only a test."
               Inherits="FALSE"
               Version="0">
    <FieldRefs>
    </FieldRefs>
    <XmlDocuments>
      <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
        <FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
          <Edit>_layouts/TestContentType/TestContentEdit.aspx</Edit>
          <New>_layouts/TestContentType/TestContentNew.aspx</New>
        </FormUrls>
      </XmlDocument>
    </XmlDocuments>
  </ContentType>
</Elements>

But when I click "Add Item" in my list that is using this content type the standard form comes up. Am I going at this wrong?

2
  • Did you test with new list after the feature was activated? I guess it may not work with list that already exist when you activated the feature. Commented Oct 12, 2011 at 0:11
  • How are you adding the content type to the list? Also, is the content type the default on the list?
    – CMN
    Commented Sep 15, 2012 at 20:21

1 Answer 1

1

Never tried it this way, however I use the following method.

  • I basically create a list definition and assign the custom form to it.
  • Then I create my lists from the definition in code.

May be of some use to you.

I create a List Definition and deploy it to the site. My List Definition schema file has the following:

...
<Forms>
      <Form Type="DisplayForm" SetupPath="features\FeatureName_Feature1\ListDefinitionName\CustomDisplayForm.aspx"
                Url="Forms/DispForm.aspx" WebPartZoneID="Main" UseLegacyForm="TRUE" />
      <Form Type="EditForm" SetupPath="features\FeatureName_Feature1\ListDefinitionName\CustomEditForm.aspx"
                Url="Forms/EditForm.aspx" WebPartZoneID="Main" UseLegacyForm="TRUE" />
      <Form Type="NewForm" Url="Forms/Upload.aspx" WebPartZoneID="Main" />
      <Form Type="NewFormDialog" Path="EditDlg.htm">
...

The set up path is where my custom forms are located and in my case, thats in the sharepoint hive in the feature directory under templates.

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.