The template field template

Version: 10.4

Field definition items are based on the Template field template. Each template field definition item can include any of the following field properties and can define many properties.

Field name

This is the name assigned to the field when it is created. It is used as the label for the field unless the Title field is filled in.

Note

Field names must be unique. If fields are defined on a single data template with the same name, then a validation error occurs when the data template is saved. But fields can also be inherited from base templates, so an item can potentially contain multiple fields with the same name. If this occurs, Sitecore displays both fields in the Content Editor, but programmers, who use the field name to retrieve contents when using the API and XSLT Renderings, might get unexpected results.

To make code easier to read when referencing fields by name, construct field names like variable names, without special characters.

Type

The field type specifies which user interface control the Content Editor displays to accept input for this field and also controls the storage format for this field. For more information about field types, see the Data Template Field Types.

Title

The title is displayed above the field in the Content Editor, unless the title is blank, in which case the Content Editor displays the field name.

Source

The source property provides information that influences the user interface control associated with the field in the Content Editor. The behavior of the source field depends on the field’s type.

Some examples include:

  • For list field types, such as Droplink, the source property indicates a location in the content tree that includes the items included in the list displayed by the field.

  • For image and file types, the source property indicates the start folder displayed in the media library dialog box.

Note

If the path begins with a tilde (~) character, the dialog box opens with the desired folder selected, but allows the user to access the entire tree.

  • For rich text field definitions, the item specified in the source property specifies an HTML editor profile controlling the features provided by the editing interface.

  • For selection fields, the field source property can specify a Sitecore query using the query: prefix before the actual query statement, as shown in the following example.

    RequestResponse
    query:/sitecore/content/Home/Employees/*[ startswith(@EmployeeName, 'A')]

    For information about the Sitecore query syntax, see the section Sitecore Query.

Source parameters

Various fields, such as Treelist and TreelistEx, support the following parameters that are used in the Source property as an alternative to SitecoreQuery:

Parameter

Description

DataSource

The field data source item, equivalent to using a path as the field source property as described previously.

DatabaseName

The name of the database containing the data source item.

IncludeTemplatesForSelection

The user can select items associated with this comma- separated list of template names.

ExcludeTemplatesForSelection

The user cannot select items associated with this comma-separated list of template names.

IncludeTemplatesForDisplay

The user can navigate items associated with this comma- separated list of template names.

ExcludeTemplatesForDisplay

The user cannot see items associated with a comma- separated list of template names.

IncludeItemsForDisplay

The user can navigate items associated with this comma-separated list of template names.

ExcludeItemsForDisplay

The user cannot see items with this comma-separated list of IDs.

AllowMultipleSelection

The user can select more than one item.

You can separate multiple parameters in the source property with the ampersand (&) character as shown in the following example.

RequestResponse
DataSource=/sitecore/content/home&IncludeTemplatesForSelection=section,sitemap

Blob

This field is for internal Sitecore use only and must not be used.

Shared

When you select the Shared check box, the field has the same value for every numbered version in all supported languages. When the Shared property is set, changes to the field value in any language or numbered version of the item are reflected in all the other language versions and numbered versions.

You must only use Shared values in the following cases:

  • Old values of the field are irrelevant.

  • Workflow restrictions do not apply to the field value.

  • Values are very large (versioning consumes storage).

Note

If you select both the Shared check box and the Unversioned check box, then the field is shared. All versions in all languages of the item share a single value for this field. For more information about unversioned fields, see the following section in this topic.

Workflow and publishing restrictions do not apply to the values of shared fields.

Unversioned

When you select the Unversioned check box, the field has the same value for every numbered version within a language, but might have different values between languages. Unversioned fields are similar to shared fields, but the system can maintain different field values for different languages.

Note

If you select both the Shared check box and the Unversioned check box, then the field is shared. All versions in all languages of the item share a single value for this field. For more information about shared fields, see the previous section in this topic.

Workflow and publishing restrictions do not apply to the values of shared fields.

Default value

This field is for internal Sitecore use only and must not be used.

Validation

This field can contain a regular expression against which the content of the field is validated when the field is saved. In order to save the field, its value must match this regular expression.

Validation text

The system displays this message when you try to save the field and its contents do not match the expression in the Validation field.

Field security

This field opens the Assign Security dialog box for the Field Definition item. The Field Read and Field Write access rights apply.

Reset blank

If you select the Reset Blank check box, it resets the field value to NULL when the item is saved with this field set to blank. NULL fields reflect the standard value for the field.

If you select this check box, this field is not included in the search indexes.

Page Editor buttons

This field allows you to select controls that will be associated with this field in the Page Editor.

Note

For additional information about template fields, see Structure of the standard template and Validation rules and options.

Do you have some feedback for us?

If you have suggestions for improving this article,