Data are sanitized, arrays are converted to strings to be output in templates. Special placeholders are set for form controls. "Field name" below is the raw field name, without brackets for array fields.
Raw field value (or placeholder):
Sanitized field value (array fields are converted to strings):
Example:
//The value of a field named "comment". It may be a scalar value of the real input or textarea or any other form element, but it can be set with PHP as well.
Setting checkbox:
Example:
//It outputs "checked" if a single checkbox named "agree" contains "Yes" value.
//Same but for one checkbox from an array of two checkboxes named "district[]"
//Same but for one checkbox from an array of two checkboxes named "district[]"
Setting select or radio-button:
Example:
//It outputs "selected" if a single option of select named "country" is selected and its value is "Russia". See example for checkboxes if you need to use select with multiple options available to choose.
Class for empty required field:
Class for wrong filled field:
Alternative classes output:
outputs class="classname"
outputs "classname"
Validation error message:
Controller messages output:
There are 3 possible types of messages in the placeholder: failed the "required" rule fields, wrong filled fields, any messages set by addMessage() method. The last ones are output by default, see the "messagesTpl" parameter description.
Lexicon entries: [%lexicon keys%]
If any template engine (EvoTwig, EvoBlade) is used then template variables are available:
Post procession of MODX parser construction is disabled when template engine is used.