共用方式為


SelectionOptions Element (View)

Applies to: SharePoint Foundation 2010

Specifies options for a drop-down list.

<SelectionOptions
  BlankPattern = "Text"
  Len = "Integer"
  MoreText = "Text">
</SelectionOptions>

Attributes

Attribute

Description

BlankPattern

Required Text. The BlankPattern attribute is used to generate a localized text pattern for displaying text values for lookup fields that are blank (empty string). In the United States, this is localized as "(Item ^1)". ^1 is replaced with the item ID of the item being referenced.

Len

Required Integer. The Len attribute causes the members of the drop-down list to be truncated to the specified number of Unicode characters if they exceed the value of Len. This prevents the drop-down menu from being excessively wide.

MoreText

Required Text. The MoreText attribute specifies what is displayed in order to indicate that the string has been truncated (typically an ellipsis, "...").

Child Elements

None

Parent Elements

Numerous

Occurrences

Minimum: 0

Maximum: 1

Remarks

Conditional rendering is based on the display mode. New items use the default value of the field, while items in Edit mode use the current value of the field to set the value of the HTML Selected attribute, with Selected=True added for the default or current value of the item.

For Lookup field types, this element produces the sequence <OPTION VALUE=”ID”>Title</OPTION>.

Example

The following example constructs a drop-down list box and uses the SelectOptions element to delineate the options.

<HTML><![CDATA[ <SELECT TITLE=" ]]></HTML>
<Property Select="DisplayName" />
<HTML><![CDATA[ " TABINDEX=1 NAME=" ]]></HTML>
<FieldPrefix />
<Property Select="Name" />
<HTML><![CDATA[ "> ]]></HTML>
<Switch>
   <Expr>
      <Property Select="Required" />
   </Expr>
   <Case Value="TRUE" />
   <Default>
      <HTML><![CDATA[ <OPTION Value=""> ]]></HTML>
      <HTML>(None)</HTML>
      <HTML><![CDATA[ </OPTION> ]]></HTML>
   </Default>
</Switch>
<SelectionOptions Len="100" MoreText="..." />
<HTML><![CDATA[ </SELECT> ]]></HTML>