Text

Text

{{ text }}

Properties of {{ text }} objects
Name Type Description
is_valid Boolean True if the value is not empty
value String The raw unencoded value of the field - outputting the raw value may have unexpected results if the value contains HTML characters (ie: <, >, ' or ")
default_value String The default value for this field if no value is specified
field_id String The identifier for this field
label String The label for this field
output String The html encoded text of the field. May include additional markup in the editor preview to make it easier to edit content

Field containing plain text input.

Related

{{ form_field }}

{{ label_field }}

Should be used to display a text label inside a form.

{{ error_page }}

{{ menu_item }}

{{ calendar_entry }}

{{ submit_field }}

Should be used to display a submit button inside a form.

{{ checkboxlist_field }}

Should be used to display a list of checkboxes inside a form.

{{ textarea_field }}

Should be used to display a textarea field inside a form.

string

Can be any text, from the empty string ("") to the full HTML output of the template. When used alone in a conditional, all strings evaluates as true - even if they are empty or a value such as "0" or "false".

{{ date_field }}

Should be used to display a date field inside a form.

{{ select_field }}

Should be used to display a select list inside a form.

{{ button_field }}

Should be used to display a custom button inside a form.

{{ captcha_field }}

Should be used to display a captcha inside a form.

{{ stylesheet }}

{{ menu }}

{{ template }}

{{ snippet }}

{{ file_field }}

Should be used to display a file upload field inside a form.

{{ radio_field }}

Should be used to display a radio field inside a form.

{{ author }}

{{ text_field }}

Should be used to display a text field inside a form.

Properties of {{ text_field }} objects
Name Type Description
is_valid Boolean Will always be true
type String Will always be "text"
is_numeric Boolean Will be true if the field should only be used to enter numbers, which may only include integers or may include decimals as well. This is a convenience property which uses the validators to check if the field validates for numeric or decimal values
placeholder String The placeholder text to display when this field does not have a value
default_value String The text to include in this field by default when the form is initially displayed
map_to_attribute String If the user is signed into a profile when they submit this form and map_to_attribute is set, the profile attribute specified in map_to_attribute will be set to the value of this field. This should also be used to override the default value if the user is signed into a profile and the specified attribute has already been set
required Boolean Will be true if the user is required to enter text in this field
required_message String The message to display when the user attempts to submit the form without entering any text in this field
validators validators The list of validators that should be used to validate this text field, if applicable
element_id String A helper property containing a unique ID for this field on this instance of this form. This value should be different every time the form is output
subtext text Help or hint text to display together with the field
condition condition The condition that should be used to show and hide this form field
classname String CSS class name(s) to be applied to the field
field_id String The identifier for this field
label String The label for this field
output String Default HTML markup for this field, which makes a number of assumptions about other elements on the page that may or may not be included. Developers should avoid using the default output in order to guarantee that forms work as expected, including styling, validation, conditionals, and more. May include additional markup in the editor preview to make it easier to edit content

The text field may also be used to display number inputs, although there are not number-specific properties (eg: increment) so it is currently up to the template developer's discretion how they want to display number inputs

Related

{{ form_field }}

{{ label_field }}

Should be used to display a text label inside a form.

{{ form }}

{{ submit_field }}

Should be used to display a submit button inside a form.

{{ checkboxlist_field }}

Should be used to display a list of checkboxes inside a form.

{{ date }}

A field containing a user-selected date

{{ textarea_field }}

Should be used to display a textarea field inside a form.

{{ text }}

{{ hidden_field }}

Should be used to output a hidden field inside a form, which by definition is not displayed to or directly editable by users.

string

Can be any text, from the empty string ("") to the full HTML output of the template. When used alone in a conditional, all strings evaluates as true - even if they are empty or a value such as "0" or "false".

{{ date_field }}

Should be used to display a date field inside a form.

{{ select_field }}

Should be used to display a select list inside a form.

{{ button_field }}

Should be used to display a custom button inside a form.

{{ captcha_field }}

Should be used to display a captcha inside a form.

number

Can be any number, including integers, decimals, or the value 0. Any value - including 0 - evaluates as true when used alone in a conditional.

{{ profile }}

{{ condition }}

Represents the condition that should be used to show and hide form fields.

{{ file_field }}

Should be used to display a file upload field inside a form.

{{ time }}

Represents a specific instant in a specific timezone.

{{ radio_field }}

Should be used to display a radio field inside a form.

Examples

Use the truncate, truncate_to_word, or truncate_words filter to shorten text to a specific number of characters or words.

Truncating text

Copy
{% var input = 'The quick brown fox jumps over the lazy dog.' %}

truncate

{{input | truncate:33}}
The quick brown fox jumps over...
{{input | truncate:33 | size}}
33
{{input | truncate:31, " (more)"}}
The quick brown fox jump (more)
{{input | truncate:33, ""}}
The quick brown fox jumps over th
{{'Shorter than 33 characters' | truncate: 33}}
Shorter than 33 characters

truncate_to_word

{{input | truncate_to_word:30}}
The quick brown fox jumps...
{{input | truncate_to_word:30 | size}}
28
{{input | truncate_to_word:30, false}}
The quick brown fox jumps over...
{{input | truncate_to_word:30, false | size}}
33

truncate_words

{{input | truncate_words:3}}
The quick brown...
{{input | truncate_words:3, " (more)"}}
The quick brown (more)
{{input | truncate_words:9}}
The quick brown fox jumps over the lazy dog.

Prepend text onto the beginning of a string

Prepend text

Copy
{{"truck" | prepend:"fire"}}
firetruck

Append text onto the end of a string

Append text

Copy
{{"fire" | append:"truck"}}
firetruck

Demonstrates how to page Text Field.

Page Text Field

Copy
{% if page.subtitle.is_valid %}
<h2 class="page_subtitle">{{ page.subtitle }}</h2>
{% endif %}