Subject: | Using 'invalid' as invalid field flag from templates documented wrongly |
Documentation on site and in distribution mentions using template constructs like "[% IF field.invalid %]" or "[% myfield.invalid %] # invalid flag" as ways to test whether a particular field failed validation. There is no such value.
There _is_ a "form.invalid" flag for the form as a whole, not mentioned in the docs. But this is not useful for knowing when to display an error message for a particular field.
Looking in the module code I find setup for "field.error" to contain an error message when a field fails to validate, and it appears that this is the proper value to test. In fact, this code works:
[% IF field.error %]
<font color="red">[% field.error %]</font><br>
[% END %]