11.3.12 Label Templates

Centrally manage HTML markup of page item labels using label templates.

Every item can have an optional label. You can control how these labels display using label templates. For example, you could create a label template called Required Field that references an image (such as an asterisk) to indicate to the user that the field is required.

Label templates also enable you to define a before-and-after text string that gets prepended and appended to the item.

11.3.12.1 Label Template Attributes

This section describes attributes on the Edit Label Template page. To learn more about a specific attribute, see field-level Help.

11.3.12.1.1 Name

Template Name identifies the name of the template. Use the Translatable checkbox to indicate that the template contains text strings that require translation. Theme indicates the theme to which the template is a member.

Template Class identifies a specific use for the template. When you switch to a theme, all templates in one theme are mapped to corresponding templates in another theme. App Builderaccomplishes this template mapping through the assignment of a template class.

11.3.12.1.2 Definition

Definition attributes include:

Tip:

For a list of supported substitution strings and to view examples, see field-level Help.

  • Before Label - Enter HTML to display before the item label. The #ITEM_CSS_CLASSES# substitution string must be included for templates that have template options defined.

  • After Label - Enter HTML to display after the item label. Since the label automatically displays before the HTML in this region, any open HTML tags in the Before Label region should be closed.

  • Before Item - Enter HTML to be displayed directly before the form item. This is typically used to wrap an item into a DIV container or to display a help button before or after the form item.

  • After Item - Enter HTML to be displayed directly after the form item. This is typically used to wrap an item into a DIV container or to display a help button before or after the form item.

  • Item Pre Text - Enter HTML for the Item Pre Text subtemplate to format the content stored as Pre Text in the item attributes. This subtemplate can be referenced in the Before Element template with the #ITEM_PRE_TEXT# substitution.

  • Item Post Text - Enter HTML for the Item Post Text subtemplate to format the content stored as Post Text in the item attributes. This subtemplate can then be referenced in the After Element template with the #ITEM_POST_TEXT# substitution

  • Help Template - The help sub template enables developers to define the link or button used to invoke the item level help. This sub template is only rendered for items that have help defined. See "About Using #CURRENT_ITEM_HELP_TEXT# to Create Item Help."

  • Inline Help Template - The help sub template enables developers to define inline help text to be displayed immediately with the item. This sub template is only rendered for items that have inline help text defined

11.3.12.1.3 Error Display

Error Display attributes include:

Tip:

For a list of supported substitution strings and to view examples, see field-level Help.

  • On Error Before Label - Enter HTML to precede the item label when an application displays an inline validation error message for the item.

  • On Error After Label - Enter HTML to be appended to the item label when an application displays an inline validation error message for the item.

  • Error Template - Enter the HTML rendered to display the inline validation error message. Use the #ERROR_MESSAGE# substitution string to reference the message text. The error template can be included in the before and after item attributes using the #ERROR_TEMPLATE# substitution string.

11.3.12.1.4 Field Container

Field Container attributes include:

Tip:

For a list of supported substitution strings and to view examples, see field-level Help.

  • Before Label and Item - Enter HTML to be displayed before the label and item. This is typically used to wrap an item into a DIV container or field set. The Before Label and Item attribute is only rendered for pages that do not use a table grid to display form items. This includes any page using a mobile page template.

  • After Label and Item - Enter HTML to be displayed after the label and item. This is typically used to wrap an item into a DIV container or field set. The after item and label attribute is only rendered for pages that don't use a table grid to display form items. This includes any page using a mobile page template.

11.3.12.1.5 Substitution Strings

Substitution strings are used within templates to reference component values. To view the most current list supported substitution strings for a given template, view the template and find the Substitution Strings report.

Tip:

All template substitution strings must be in uppercase letters and begin and end with a number sign (#).

11.3.12.2 About Using #CURRENT_ITEM_HELP_TEXT# to Create Item Help

Use the #CURRENT_ITEM_HELP_TEXT# substitution string to create inline page Help text when a page is rendered. For example, you can use this substitution string to create page Help text which displays as a tooltip when the mouse hovers over the page item label. This placeholder enables you to include help text on the page when it is rendered without having to perform an expensive Ajax call.

Tip:

Only use this placeholder if the Help text is short. The generated page always includes the help text of all page items.

Example Label Template

Before Label:

<label for="#CURRENT_ITEM_NAME#" id="#LABEL_ID#">
<span class="helpText">#CURRENT_ITEM_HELP_TEXT#</span>

After Label:

</label>