{{ form_field }}

Properties

string object_type
Will always be "form_field".
true/false is_valid
Indicates whether or not this references a form_field.
guid guid
text field form_guid
form form
text field label
text field group_guid
form_field form_field
text field class
true/false is_readonly
text field map_to_user_attribute
text field type
text field subtext
text field default_value
text field properties
text field condition
text field validators
true/false is_required
text field required_message
number order
string value
Synonymn for guid.
html output
The default output that the form_field would produce if it were output directly to the template.
html output_in_list
The default output that the form_field would produce if it were output directly to the template from inside a list.
string id
The field name - which will be used in the form submission to identify how the field should be saved and in processing conditional fields.
string element_id
A helper property containing a unique ID for this field on this instance of this form. This value will be different every time the form is output.
html validation_placeholder
A helper property to assist in creating the field markup. Contains a hidden and empty span which will be used by the field javascript to display error messages if the field fails to validate. If the field does not require validation then this is just an empty string.
html pre_element
A helper property to assist in creating the field markup. Contains the container element (div, fieldset, etc...) to wrap around the field - including any classes defined on the field or used by the form javascript.
string classes
The classes to be included on the container element for this field. Includes both classes defined on the form field and used by the form javascript.
html post_element
A helper property to assist in creating the field markup. Closes the container element opened by pre_element.
html label_element
A helper property to assist in creating the field markup. Contains the element to be output as the label for this field (legend, &lgt;span class=label>, etc...). For required fields this includes the <span class=required> element.
html form_element
A helper property to assist in creating the field markup. Contains the actual form element for this field (input, textarea, select, etc...).
list fields
A list containing all of the child fields that are direct children of the current field. This is only meaningful if the current field is a group field.
varies varies
Each of the officially-supported configuration options may be accessed on the form_field object. If an option is not specified and has no default, the value in the form_field property will be null/empty:
  • string accept - for file fields. Specifies the types of files that may be uploaded.
  • true/false allow_multiple - for select lists. If true, multiple values may be selected.
  • string date_options - for date and datetime fields. Contains a JSON-encoded string with options specifying how the date field should be displayed.
  • string delimieter - for checkboxlist, radio, and select lists. Contains the character used to separate the list of options.
  • string format - for the date and datetime fields. Contains the format that should be used when displaying the value of this field.
  • number max_length - for the text field. The maximum number of characters allowed.
  • number min_length - for the text field. The minimum number of characters allowed.
  • list options - for checkboxlist, radio, and select lists. Contains a list of options where each option includes both the string Key (value) to be saved when the option is selected and the string Value text to be displayed.
  • string placeholder - for the text field. Contains the placeholder to display while the field is empty.
  • string tag_type - for the label field. Contains the type of tag to use when displaying the label (eg: 'p', 'h3', etc...).
  • string timezone - for the datetime field. Contains the timezone that the date/time should be saved in.
  • string timezone_field - for the datetime field. If specified and the field exists on this form, use that field to get/save/change the timezone for the current field instead of it's own timezone selector. Do not use both this and the Timezone option field.
  • true/false timezone_locked - for the datetime field. If set to true, the timezone selector should not be displayed. Do not use with the TimezoneField option field.
  • string validation_message - for all fields with validation. If validation fails, display this message instead of the "smart default".
  • string value_delimiter - for checkboxlist, radio, and select lists. Contains the character used to separate the text and the value of each option in the list of options.
  • string theme - for the captcha field. Specifies the theme with which the captcha should be displayed (light/dark).
  • string captcha_size - for the captcha field. Specifies the size that the captcha will be displayed (compact/normal).
  • string button_type - for the button field. Specifies the type of button to be displayed (button/submit/reset).
  • string on_click - for the button field. Specifies javascript to be executed when the button is clicked - for the onclick attribute.
  • html html_value - for the button and submit fields. Contains the HTML to be displayed inside the button.

Examples

Recommended for outputting a form field

{{ field }} Alternatively: {{ field.default_output }}

Simple code sample to display a form with groups.

{{ form.form_start }} {% for field in form %} {% case field.type %} {% when "group" %} {% unless field.fields == empty %} <fieldset{% if field.class %} class="{{ field.class }}"{% endif %} {{ field.condition_property }}> <label>{{field.label}} {% for subField in field %} {% unless subField.type == "group" %} <div class="field" {{ subField.condition_property }}> {{ subField.form_element }} {{ subField.validation_placeholder }} </div> {% endunless %} {% endfor %} </fieldset> {% endunless %} {% when "label" or "hidden" %} {{ field.form_element }} {% else %} <div class="field" {{ field.condition_property }}> {{ field.form_element }} {{ field.validation_placeholder }} </div> {% endif %} {% endfor %}

Developer Overview

Liquid Markup