Content types and list forms

user635
  • Content types and list forms user635

    I've encountered the strangest problem. I've got two features:

    • ContentTypes: contains a couple of custom fields and a content type (based on plain ol' 0x01) called Withdrawals that uses them. Scoped to Site.
    • Registration: contains a ListTemplate and a ListInstance that just modifies a basic Custom List to enable content types and add my custom content type. Scoped to Web.

    Here's what's happening. When I activate ContentTypes, the content type and field are deployed as expected into my site collection. When I activate Registration, the list is provisioned and the content type is added as expected.

    When I try to add a new item to the list, the list form only shows the Title field from Item. Now, here's the weird part. If I add a second content type to the list (through the UI), the list form suddenly works correctly. This makes me think there's something wrong with my content type. Here's what I'm working with. Some names have been changed to protect the innocent.

    <ContentType ID="0x0100B4366B5F6383463b8464DBD2EDD5E097"
               Name="Withdrawal"
               Description="Record of a team withdrawal"
               Hidden="False">
     <FieldRefs>
       <FieldRef ID="{CE8F7528-E643-4473-94E0-BAA57BD2F6E6}"/>
       <FieldRef ID="{E508D1FA-D3A5-4e91-828B-3BFB43D4F7C5}"/>
     </FieldRefs>
    <XmlDocuments>
      <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
        <FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
          <Display>ListForm</Display>
          <Edit>ListForm</Edit>
          <New>ListForm</New>
        </FormTemplates>
      </XmlDocument>
    </XmlDocuments>
    

    And here are the relevant bits of SCHEMA.XML:

    <List xmlns:ows="Microsoft SharePoint" Title="Withdrawals" FolderCreation="FALSE" Direction="LTR" Url="Lists/Withdrawals" EnableContentTypes="TRUE" BaseType="0">
      <MetaData>
        <ContentTypes>
          <ContentTypeRef ID="0x0100B4366B5F6383463b8464DBD2EDD5E097" />
          <ContentTypeRef ID="0x0120" />
        </ContentTypes>
        <Fields>
          <Field ID="{CE8F7528-E643-4473-94E0-BAA57BD2F6E6}" Name="TeamName" StaticName="TeamName" DisplayName="Team Name" Type="Text">
          </Field>
          <Field ID="{E508D1FA-D3A5-4e91-828B-3BFB43D4F7C5}" Name="WithdrawalComments" StaticName="WithdrawalComments" DisplayName="Withdrawal Comments" Type="Note">
          </Field>
        </Fields>
    

    It's also been added to the ViewFields in the two default views. What the heck am I doing wrong here?

  • After hours of frustration, I finally figured out the problem. In the <ContentType> element, you need to specify both the ID and Name in each FieldRef. When I added the Name attribute to each FieldRef, those fields began to appear as expected on the item forms.

Tags
content-type list feature
Related questions and answers
  • :EcmaScriptEncode($ListName),'};'))}"&gt;&lt;/input>&lt;/td> I need to add javascript within the DataFormWebPart so I can update another form field when the user clicks the 'Complete Task' button. I...']").click(function(){ $("input[type=checkbox]").attr("checked", true); }); This changes the form field succesfully but does not save to the list when the form submits. I have also tried to call...="QueryString(ID)" DefaultValue="0"/&gt; &lt;ParameterBinding Name="ListName" Location="QueryString(List)" DefaultValue=""/&gt; &lt;/ParameterBindings> &lt;datafields>@Title,Title;@Priority

  • I have a content type defined in Elements.xml and I want to add an Event Receiver. My Elements.xml looks like this: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Elements xmlns="http... TargetName="_cts/News Posting" /&gt; &lt;Fields> &lt;Field ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName...="" ShowInNewForm="TRUE" ShowInEditForm="TRUE" /&gt; &lt;Field ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" Name="Body" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Body" Group

  • in-browser and they are visible in SPDesigner, but when I "View All Site Content" they are not there. Why is this the case? The Feature's Elements File: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Elements Id="9e85eb79-6d8d-4ff3-b0d4-64d55c3bb577" xmlns="http://schemas.microsoft.com/sharepoint/"&gt; &lt;Module Name="Pages" Url="Pages"&gt; &lt;File Path="Example.aspx" Url.../Pages/Example.aspx When I "View All Site Content" I am looking at the contents of the "Pages" list: http://myserver:PORT/subsite/Pages/Forms/AllItems.aspx

  • I've customized alert notification template for Announcements list. Here is custom code: &lt;Immediate> &lt;Subject> &lt;Switch> &lt;Expr> &lt;GetVar Name...; &lt;Case Value = "1"&gt; &lt;HTML> &lt;![CDATA[A new content has been added to Latest Events. To view, please visit: &lt;a href... Name="DisplayName#{Field}" HTMLEncode="TRUE" /&gt; &lt;HTML>&lt;![CDATA[ : ]]&gt;&lt;/HTML> &lt;GetVar Name="NewValue#{Field}" /&gt; &lt

  • I've created a Custom List ('Tooltips') in SharePoint. After this I used SPSource to reverse engineer the list into a feature. After installing and activating this feature, I want to add this list in a WebPart zone. When doing this, I get an error message : Tooltips: List View Web Part could not be added, list may be hidden. What's wrong with the list? feature.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Feature Id="70d49f3d-233a-482d-97e3-dcec2c236171" Title="MyApp - Tooltips" Description="Creates a Tooltips list which can be used for mouse-over texts

  • the 'ListForm' it works. So I'm thinking that I've done something wrong in the content type definition. Here is the code: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt; &lt;Field ID="{9381E2BE-CE62-4673-9C0D-8A7E4B087B55}" Name="MyPal" DisplayName="My Pal" Type="Text" /&gt; &lt;!-- Parent ContentType: Item (0x01) --&gt; &lt;ContentType ID="0x01009dea68f3be5946789ab1a8ac699fcb8f" Name="UnderstadingContentTypes - MyContentType" Group="Custom Content Types" Description="My Content Type

  • So I did create on an SPWeb 20 custom lists and then a tasks list. For each of those 20 lists I've created 20 site lookup columns. I then created 20 Content Types based on Task content type. Then I've added each content type to the Tasks list. After that I've added each lookup site column to the corresponding list content type. So far so good. I've built a custom WebPart that displays task items... and not the id) &lt;Query> &lt;Where> &lt;Eq> &lt;FieldRef Name='Relaterat_x0020_till_x0020_avtal' /&gt; &lt;Value Type='Lookup'&gt;Test avtal</Value>

  • contains a hyperlink. My CAML render pattern looks like: &lt;RenderPattern Name="DisplayPattern"&gt; &lt;Switch> &lt;Expr> &lt;Column /&gt; &lt;/Expr> &lt;Case Value...;/RenderPattern> In WSS 3.0, this would render the 2nd column in the field as a hyperlink in the LVWP, which is what I want. In SharePoint 2010, I tried adding TRUE to my field type definition...="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal"&gt; &lt;xsl:template match="FieldRef[@FieldType='DataLinkUrl']" mode="Note_body"&gt; &lt;xsl:param name="thisNode" select="."/&gt; &lt;xsl

  • \"?&gt;" + "&lt;webParts>&lt;webPart xmlns=\"http://schemas.microsoft.com/WebPart/v3\"&gt;" + "&lt;metaData>" + "&lt;type name...;Microsoft.SharePoint.WebPartPages.ContentEditorWebPart&lt;/TypeName> &lt;ContentLink xmlns=\"http://schemas.microsoft.com/WebPart/v2/ContentEditor\" /&gt; &lt;Content xmlns=\"http://schemas.microsoft.com...()); } UPDATE: Based on feedback from Wictor, I tried the following: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;webParts> &lt;webPart xmlns="http://schemas.microsoft.com/WebPart/v3"&gt; &lt

Data information