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