formerror
Templating System : Designer Guide : Tag Reference : formerrorSummary
The formerror tag is used to specify the presentation of a form validation error.
Usage
<formtemplate id="add_user"> <table> <tr> <td>First Name</td> <td> <formwidget id="first_name"> <formerror id="first_name" type="no_special_characters"> The first name may not not contain special characters such as @, $, !, %, & or #. </formerror> </td> </tr> </table><br> <input type="submit" value="Submit"> </formtemplate>
Another example:
<formtemplate id="add_user"> <table> <tr> <td>First Name</td> <td> <formwidget id="first_name"> </td> </tr> <formerror id="first_name"> <tr> <td colspan="2"><font color="red">@formerror.first_name@</font></td> </tr> </formerror> </table><br> <input type="submit" value="Submit"> </formtemplate>
This adds another table row which contains the error message for that widget in red color. If there is no error then the table row will not be added.
Notes
The contents of the formerror tag may appear on the form when a submission is returned to the user for correction.
The contents of the tag may use the special variables label and value to refer to the element label and submitted value.
You can use the variable @formerror.element_id@ to refer to the automatically generated error message within the formerror tags.
The type attribute is optional and is used to distinguish messages for specific types of validation errors. Each element may have any number of error messages associated with it, corresponding to each of the validation checks performed by the developer in the script associated with template.
If the contents of the tag are empty (<formerror></formerror>), the message specified by the developer in the script are inserted when appropriate. This is particularly useful for international sites, where locale-dependent messages may be stored in the database.
If the type attribute is not specified and the contents of the tag are empty, all appropriate messages are inserted (separated by <,br> tags).
See the formwidget and formgroup tags for more information on writing the body of a dynamic form template.