Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Registers a form field by name, in Plate. This ensures that when a form is submitted Plate expects this form, and possibly validates the field. The tag can only be used within a form block. It accepts the name of the field as an input (for example “Naam” or “Email”), but also whether this field should be validated (with the required argument). 

Accepts the following arguments (excluding the first argument, which is the name):

  • required: whether the registered field should be validated on presence. (Default: false)

  • array: whether the input sent for the registered field is an array. E.g. with multiple file fields (Default: false)

Example:

{% register_form_field field_line.name, required: field_line.required, array: false %}

Note that this tag does not directly output anything in the HTML. In the background this tag adds some information to a hash that is generated by the form tag. 

To generate the HTML, use the form_input_name and html_input filters.

Input:

{{ "Name" | form_input_name | html_input: "checkbox" }}

Output:

<input type="checkbox" name="form_message[content][name]">

  • No labels