Form-errors Tag
If a form submission encounters a validation error, you can use this tag to loop through the error messages and show your user where everything went south.
Example
This tag can be used both as a conditional and as the data itself.
{{ form:set is="contact" }}
{{ if {form:errors} }}
<p>Oops, here's what went wrong:</p>
<ul>
{{ form:errors }}
<li>{{ value }}</li>
{{ /form:errors }}
</ul>
{{ /if }}
{{ form:create }}
...
{{ /form:create }}
{{ /form:set }}
Hot Tip!
form:errors
is a Tag, not a variable. Be sure to wrap it with single braces when inside a condition.

<s:form:set
is="contact"
>
<s:form:errors
as="errors"
>
@if (count($errors) > 0)
<p>Oops, here's what went wrong:</p>
<ul>
@foreach($errors as $error)
<li>{{ $error['value'] }}</li>
@endforeach
</ul>
@endif
</s:form:errors>
<s:form:create>
...
</s:form:create>
</s:form:set>
Parameters
handle|is|in|form|formset
string
Specify the name of the form. Only required if you do not use the form:set
tag, or don't have a form
defined in the current context.
Variables
Variable | Type | Description |
---|---|---|
value |
string |
This tag contains a primitive array. In each iteration, the |
Docs Feedback
Submit improvements, related content, or suggestions through Github.
Betterify this page