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 have tried to create a custom form template but without success. I have followed several tutorials but it still does not use the custom template. If I change the template id to override the 'ListForm' it works. So I'm thinking that I've done something wrong in the content type definition. Here is the code:

   <?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field ID="{9381E2BE-CE62-4673-9C0D-8A7E4B087B55}" Name="MyPal" DisplayName="My Pal" Type="Text" />
  <!-- Parent ContentType: Item (0x01) -->
  <ContentType ID="0x01009dea68f3be5946789ab1a8ac699fcb8f"
               Name="UnderstadingContentTypes - MyContentType"
               Group="Custom Content Types"
               Description="My Content Type"
               Inherits="TRUE"
               Version="0">
    <FieldRefs>
      <FieldRef ID="{9381E2BE-CE62-4673-9C0D-8A7E4B087B55}" Name="MyPal" DisplayName="My Pal" />
      <FieldRef ID="{77EEC76F-561A-422B-8975-21DCB2EC6C7B}" Name="External" DisplayName="external"/>
    </FieldRefs>
    <XmlDocuments>
      <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
        <FormTemplates  xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
          <Display>MyCustomForm</Display>
          <Edit>MyCustomForm</Edit>
          <New>MyCustomForm</New>
        </FormTemplates>
      </XmlDocument>
    </XmlDocuments>

    <!--<XmlDocuments>
      <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v4/contenttype/forms">
        <FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v4/contenttype/forms">
          <Display>MyCustomForm</Display>
          <Edit>MyCustomForm</Edit>
          <New>MyCustomForm</New>
        </FormTemplates>
      </XmlDocument>
    </XmlDocuments>-->
  </ContentType>
</Elements>

And here is the template code. It is just made to show that it works:

<%@ Control Language="C#"   %>
<%@Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@Register TagPrefix="SharePoint" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.WebControls"%>
<%@ Register TagPrefix="wssuc" TagName="ToolBar" src="/_controltemplates/ToolBar.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBarButton" src="/_controltemplates/ToolBarButton.ascx" %>


<SharePoint:RenderingTemplate id="MyCustomForm" runat="server">
<Template>
Hello My Template
</Template>
</SharePoint:RenderingTemplate>
share|improve this question
1  
Can I just point out that the title of this question mentions SP2010 yet the code in the template sample uses version 12 of all the assemblies... –  James Love Jun 11 '10 at 10:39
    
@James: That's true although the binding redirects should sort that out. Still, not recommended! –  Alex Angas Jul 1 '10 at 4:43
    
Inherits="TRUE" is the culprit summit7systems.com/blogs/jamescurry/?p=10 –  Dennis G Jan 20 '11 at 11:29

3 Answers 3

if u remove Inherits="True" from ur content type definition then it should work. i am not sure why, but the template settings get lost if inherit is set to true.

Hope this works.

Anna

share|improve this answer

I had a problem getting my workflow to use a custom task form template that I deployed. The problem was that I was not inheriting from the Workflow Task ContentType properly. I had to prepend the content type id with the task id (0x010801), but I also had to append that ID with two zeros. (I could not find the rational for that, but it was neccessary.) Using that same rational, what happens if you pad your ContentType ID?

Also, are you also deploying your template form? (e.g. MyCustomForm)?

Here is the code snippet for my Task Form that I was able to use in replace of a workflow task form:

  <!-- Field Elements -->
  <Field ID="{9781B75F-FDB2-4523-9516-9B6FF1DC5930}"
    Name="VID"
    DisplayName="VID"
    Group="My Task Content Type Columns"
    Type="Text"
    Required="FALSE">
  </Field>
<!-- Parent ContentType: Task + 00 (0x01080100) -->
  <ContentType ID="0x01080100283F3E837128472399895F22E79FC50C"
             Name="My Task ContentType"
             Group="My Content Types"
             Description="My Task Content Types"
             Version="0"
             Hidden="FALSE">
    <FieldRefs>
      <!-- Fields (match GUID with FieldID)-->
      <FieldRef ID="{9781B75F-FDB2-4523-9516-9B6FF1DC5930}"></FieldRef>
    </FieldRefs>
    <!-- Custom Task Form definition-->
    <XmlDocuments>
      <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
        <FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
          <New>_layouts/MyTaskForm/TaskForm.aspx</New>
          <Display>_layouts/MyTaskForm/TaskForm.aspx</Display>
          <Edit>_layouts/MyTaskForm/TaskForm.aspx</Edit>
        </FormUrls>
      </XmlDocument>
    </XmlDocuments>
  </ContentType>
share|improve this answer
    
I found the rational for the two hex values between the parent content Id and a GUID: msdn.microsoft.com/en-us/library/aa543822.aspx –  JakeJacobsen Jun 17 '10 at 14:10

Hi Yes setting the Inherits="True" does work, but then you loose the advantage of inheritance. In my case this whas not acceptable.

What worked for me whas to deploy my Contenttype with Inherits = True And then a second depoyment where Inherits= False.

Then I whas able to keep the advantage of inheritance, and get my custom Task edit form working.

Think this must be a bug in SharePoint 2010.

share|improve this answer
    
What do you mean that you first deploy with inherits=true and afterwards inherits=false? –  Dennis G Jan 20 '11 at 11:30

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.