views:

740

answers:

3

I've defined a custom list template with the following fields:

<Fields>
      <Field Type="Text" DisplayName="Sub-Title" Name="SubTitle" StaticName="SubTitle" ShowInNewForm="TRUE" 
             ShowInEditForm="TRUE" ShowInViewForms="TRUE">        
      </Field>
      <Field Type="URL" DisplayName="Header Image" Name="HeaderPicUrl" StaticName="HeaderPicUrl" ShowInNewForm="TRUE" 
             ShowInEditForm="TRUE" ShowInViewForms="TRUE">
      </Field>
      <Field Type="Note" RichText="True" RichTextMode="FullHtml" IsolateStyles="True" NumLines="5" Name="Summary" DisplayName="Summary" 
             StaticName="Summary" Sortable="False" ShowInNewForm="TRUE" ShowInEditForm="TRUE" ShowInViewForms="TRUE">
      </Field>
      <Field ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" Type="Note" RichText="TRUE" RichTextMode="FullHtml" IsolateStyles="TRUE" 
             NumLines="45" Name="Body" DisplayName="$Resources:core,camlid2;" Sortable="FALSE" 
             SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Body">
            </Field>
      <Field ID="{6a09e75b-8d17-4698-94a8-371eda1af1ac}" Type="DateTime" Name="Expires" DisplayName="$Resources:core,camlid3;" 
             Format="DateOnly" FromBaseType="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Expires">
      </Field>
</Fields>

Note that the ShowInNewForm, ShowInEditForm, and ShowInViewForms properties are all set to TRUE. When I create a list from the deployed template (I'm doing this from VSeWSS 1.3), the list has the correct fields, but a new item form doesn't render the custom fields at all. Anyone know why this would be so? Do I have to fully customize the control templates loaded by the ListFormWebPart Doesn't that defeat the purpose of the ListFieldIterator control?

Edit:

Also, the end of the schema.xml file has this bit:

<Forms>      
    <Form Type="DisplayForm" Url="DispForm.aspx" WebPartZoneID="Main"/>
    <Form Type="EditForm" Url="EditForm.aspx" WebPartZoneID="Main"/>
    <Form Type="NewForm" Url="NewForm.aspx" WebPartZoneID="Main"/>
</Forms>
A: 

When you say that you created your list templates with the fields listed here, do they belong to a content type? If so, does the definition of the columns in the content type match the definition of the fields in the schema.xml?

Did you re-create the list after making the changes to the schema.xml?

EDIT: Fields to include in the schema.xml. If the fields aren't there but are only where you defined your columns, then that's probably why they don't appear in the newForm.aspx when you create a new item.

<Field Type="Text" DisplayName="..." Description="..." Required="FALSE" MaxLength="255" Group="..." ID="{GUID}" Name="..." Hidden="FALSE" ReadOnly="FALSE" />
Hugo Migneron
There's no content type associated with these fields.
Ben Collins
To answer your question, no, you don't need to customize the control templates, the fields are meant to appear.The snipped with the <Fields> that you put in the question, where is that located in your code, in the schema.xml? I don't that the default for the HIDDEN attribute is true, but wouldn't hurt to add it. I edited my reply with fields that are normally included in the <Fields> section in the schema.
Hugo Migneron
A: 

Any solution here? Got the same issue :-/ . Greetings, Felix

Felix Kollmann
I ended up creating a custom content type, creating the list from that, and then I was able to customize the forms. I never found a direct solution to the problem, or even found an explanation.
Ben Collins
+1  A: 

I just ran into something very similar. Custom fields were not being rendered by the ListFieldIterator. The list was based on a custom list definition and a custom content type and included custom list forms. The custom fields showed up in the content type as well as from the settings page of the list. The custom list forms were copies of the out-of-box (12\Template\Pages\)form.aspx file.

The content type contained FieldRef tags ala:


      <FieldRef ID="{73AB0549-19DA-43af-938B-873EAD93FE4E}" />

This format is suggested in a few places, e.g. Furuknap's Building the SharePoint User Experience (pp. 261).

Adding the Name attribute in the <FieldRef> tag fixed the issue.


      <FieldRef ID="{73AB0549-19DA-43af-938B-873EAD93FE4E}" Name="TestAttachment1" />

Based on this experience I plan on always including the Name attribute in the FieldRef elements of custom content types. Hope this saves someone else some time.

Jason Weber