共用方式為


Form Element (List)

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Describes the forms in a base list type.

<Form
  Path = "Text"
    SetupPath = "Text"
    Template = "Text"
  Type = "DisplayForm" | "EditForm" | "NewForm"
  Url = "URL"
    UseLegacyForm = "TRUE" | "FALSE"
  WebPartZoneID = "Text">
</Form>

Attributes

Attribute

Description

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.

UseLegacyForm

Optional Boolean. Used during upgrade to specify that Windows SharePoint Services 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

Parent Elements

Forms

Occurrences

Minimum: 0

Maximum: Unbounded

Example

The following example outlines the forms definition within the Schema.xml file for announcements lists.

<Forms>
  <Form Type="DisplayForm" Url="DispForm.aspx" WebPartZoneID="Main">
    <ListFormOpening>
      ...
    </ListFormOpening>
    <ListFormButtons>
      ...
    </ListFormButtons>
    <ListFormBody>
      ...
    </ListFormBody>
  </Form>
  <Form Type="EditForm" Url="EditForm.aspx" WebPartZoneID="Main">
    <ListFormOpening>
      ...
      .
    </ListFormOpening>
    <ListFormButtons>
      ...
    </ListFormButtons>
    <ListFormBody>
      ...
    </ListFormBody>
    <ListFormClosing>
      ...
    </ListFormClosing>
  </Form>
  <Form Type="NewForm" Url="NewForm.aspx" WebPartZoneID="Main">
    <ListFormOpening>
      ...
    </ListFormOpening>
    <ListFormButtons>
      ...
    </ListFormButtons>
    <ListFormBody>
      ...
    </ListFormBody>
    <ListFormClosing>
      ...
    </ListFormClosing>
  </Form>
</Forms>