开发者

Fields in custom SharePoint list template not rendered list item forms

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:


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


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" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜