Partilhar via


Form Element (List)

Applies to: SharePoint Foundation 2010

Describes the forms in a base list type.

<Form  Default = "TRUE" | "FALSE"  MobileUrl = "Text"
  Path = "Text"
  SetupPath = "Text"
  Template = "Text"
  Type = "DisplayForm" | "EditForm" | "NewForm"
  Url = "URL"  UseDefaultListFormWebPart = "TRUE" | "FALSE"
  UseLegacyForm = "TRUE" | "FALSE"
  WebPartZoneID = "Text">  <WebParts>    <AllUsersWebPart      WebPartOrder = Integer      WebPartZoneID = "Text">        <![CDATA[...]]>    </AllUsersWebPart>  </WebParts>
</Form>

Attributes

Attribute

Description

Default

Optional Text. Specifies whether the form is the default form to use for the specified Type. For example, one can define multiple forms for which Type equals DisplayForm. If this is the case, then a default display form must be established so that a list can determine which display form to use. If multiple forms are defined that have the same Type, and a default form is not established by specifying Default="TRUE", then a default form will be chosen programmatically. If there is only one form that is defined for a specified Type, then Default="TRUE" is enforced programmatically.

MobileUrl

Optional Text.

Path

Optional Text. Specifies the file system path, including the leaf name, of the file containing the template used for the list of document libraries that is rendered in a file dialog box. The value of this attribute is relative to the _layouts directory and does not start with a forward slash ("/").

SetupPath

Optional Text. Specifies the relative path to the folder in the setup directory that contains the .aspx page of the form, for example, pages/form.aspx.

Template

Optional Text. Specifies the list template to which the form belongs.

Type

Required Text. Indicates the type of form being described and can be one of the following values: DisplayForm, EditForm, or NewForm.

Url

Required URL. Specifies the path to the ASP.NET file used for the form.

UseDefaultListFormWebPart

Optional Text. Specifies whether a ListFormWebPart should be created when the form is provisioned. By default, a ListFormWebPart object is created unless this attribute is set to FALSE. If this attribute equals FALSE, use the WebParts child element to define your customized list form Web Part.

UseLegacyForm

Optional Boolean. Used during upgrade to specify that Microsoft SharePoint Foundation use Collaborative Application Markup Language (CAML), as in previous versions of the technology, instead of Web controls, to define the view of an item within a form.

WebPartZoneID

Optional Text. Specifies the zone for the Web Part.

Child Elements

ListFormBody, ListFormButtons, ListFormClosing, ListFormOpening, WebParts

Parent Elements

Forms

Occurrences

Minimum: 0

Maximum: Unbounded

Example

The following example shows the form definitions that are specified in the Schema.xml file for Announcements lists.

<Forms>
      <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
      <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
      <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    </Forms>