Forms

Errors And Success

Forms have helpers for field errors, all errors, and successful submissions.

Field Errors#

Use form:error:name beside the matching field:

php
<label>Name</label><input name="name" required>{{ form:error:name }}

Add attributes when you need styling:

php
{{ form:error:name class="field-error" }}

TemplateX connects discovered inputs to the matching error element with aria-describedby.

All Errors#

Use form:errors when you want one summary area:

php
{{ form:errors class="form-errors" }}

It renders a list of current form errors and stays hidden when there are no errors.

Success Blocks#

Use form:success for content that appears after a successful submission:

php
{{ form:success }}  <p>Thanks, {{ name }}.</p>{{ /form:success }}

Inside the success block, submitted values are available by field name.

Password values are not exposed back to the page.