The Simple field types

Abstract

Overview of the various simple field types available.

Simple field types represent an individual value. This individual value can have multiple properties, such as the attributes in an Image field or the images and links in a Rich Text field.

This field type displays a toggle button. If the user selects the check box, Sitecore stores the value 1 (the number one). If the user does not select the check box, Sitecore stores a blank value.

Tip

Check for the literal value 1 in a check box field, or use a property such as Sitecore.Data.Fields.CheckboxField.Checked. Do not compare the value of a check box field against NULL, String.Empty, 0 (the number zero), or any value other than 1.

The Hidden check box is in the Appearance section of the Standard template.

The Date field type provides a user interface allowing a user to manually select or enter a date. The Datetime field type adds a user interface to select or enter a time manually. Sitecore stores the content as a text string with the format yyyymmddThhmmss. If the user does not enter a time, Sitecore stores the value 000000 (midnight). The value stored represents the local time for the Web server.

Calendar where you can select or enter a date

The following image shows the Valid from Datetime field in the Lifetime section of the standard template, including the drop-down list of times.

Valid from and to lists

The File field type allows the user to select an item in the Media Library. Users can click Open file to open the Media Browser and select the relevant file from the Media Library.

You can use the Source property of a File field to control the media folder selected when the user opens the Media Browser, or to specify the root item for this selection interface.

  • If the Source property of a File field specifies an item, the Media Browser cannot navigate above that item. The user cannot navigate above the specified media folder. The default Source for File field is the root item in the Media Library (/Sitecore/Media Library).

  • If the Source property of a File field starts with a tilde character (~/Sitecore/Media Library/Files), the Media Browser shows the entire Media Library content tree with the specified media folder selected, allowing the user to navigate above that media folder.

The Image field type lets the user select an image from the Media Library and specify image properties. Users can click Open file to open the Media Browser and select the relevant file from the Media Library.

The Source property of an Image field type controls the selected item in the Media Browser. For more information about the Source property, see The simple field type.

The following image shows the Image field from the Home-Products item in the Starter Kit.

Image field

These field types store a single line of text.

The Password field type stores plain text, but masks input in the Content Editor. Sitecore does not hash or otherwise mask the provided text in the database.

Use the Multi-Line Text field type for simple text values spanning multiple lines. This field has no validation and there is no Rich Text support for fields of this type.

This field type stores HTML text. The field displays the contents as a browser would display the source HTML, although the field actually stores character encoded HTML. You can click Show Editor to access the Rich Text Editor, and Edit Html to access the stored HTML. For further information about Rich Text fields, see the Content Reference manual.

The following image shows a rich text field that includes an internal link and an image:

Rich Text Field Type

Note

The Word Document field type requires Microsoft Internet Explorer 6 or higher. For instructions to configure Internet Explorer, see the Internet Explorer Configuration Guide.

You can set the value attribute of the /configuration/sitecore/settings/setting element in the web.config file:

  • To control the width of the editor - with the name WordField.InlineEditing.Width.

  • To control the height of the editor - with the name WordField.InlineEditing.Height.

  • To control the padding of the editor - with the name WordField.InlineEditing.Padding.

Each List field type lets users select zero or more items using different user interfaces providing different features. The Source property of the field specifies the options in the list.

Note

If the Source property specifies an item, the Checklist, Droplist, and Multilist fields display the children of the specified item, and the Droptree, Internal Link, Treelist, and Treelist field types root the tree at the specified item.

The source property of the Checklist, Droplist, Droptree, and Multilist field types support Sitecore query. For more information about Sitecore query, see the section Sitecore Query.

Tip

The Checklist, Droptree, Multilist, Treelist, and TreelistEx field types store the GUIDs of the items selected by the user separated by a pipe character (“|”). If the field stores a reference to a single item, you can access it using the Sitecore.Data.Fields.ReferenceField class or the sc:item() XSL extension method. If the field stores more than one reference, you can access the selected items using the Sitecore.Data.Fields.MultilistField class or the sc:Split() XSL extension method.

The Multilist with Search field type

A Mulitilist with Search field type has no limitation and can scale to thousands of items. We recommend that you use this field type when referring to very large lists of items not just items that are in item buckets.

Use this field to attach a search query to a multilist field and display the search results as selectable items. For example, if you want a multilist of all product items, you can set the source field of the field to TemplateFilter=”Product ID” and this returns the items in the list.

The Treelist with Search field type

The Treelist with Search field type allows you to reference items in much the same way as a multilist field type. However, you can also enter a GUID to determine the start location of the search. This overrides the default filter that has been set on the template. You can use the search box to find the items in this field and search adheres to any filters applied.

The Checklist field type

The Checklist field type lets users select one or more check boxes representing the children of the item specified by the Source property of the field. The user cannot order their selection.

The Droplist field type

The Droplist field type lets users select a single item from the list specified by the Source property of the field.

Important

The Droplist field type stores the name of the selected item. The Droplink field type stores its ID. For more information, see General Link with Search Type.

The Grouped Droplink field type

The Grouped Droplink field type lets users select a single grandchild of the item specified by the Source property of the field. The Grouped Droplink field type stores the GUID of the selected item.

The Grouped Droplist field type

The Grouped Droplist field type lets users select a single grandchild of the item specified by the Source property of the field. The Grouped Droplist field type stores the name of the selected item.

The Multilist field type

The Multilist field type lets users select zero or more items from the list specified by the Source property of the field. The user can sort the selected items.

The Name Value List field type

The Name Value List field type lets users enter values for zero or more arbitrary keys. Sitecore stores the values entered as a list of key=value pairs separated by ampersands (“&”). Sitecore uses the Name Value List field type for rendering parameters.

The Treelist and TreelistEx field types

The Treelist field type lets users select zero or more descendants of the item specified by the Source property of the field. The user can sort the selected items.

The TreelistEx field type provides the same functionality as the Treelist field type, but only displays the selected items until the user elects to edit the list, which opens a new browser window. The Content Editor loads TreelistEx field types more quickly than Treelist field types.

Tip

Use the Treelist field type for fields that users edit frequently; use the TreelistEx field type for fields that users edit less frequently.