HTML_QuickForm_Renderer_ArraySmarty::setErrorTemplate()

HTML_QuickForm_Renderer_ArraySmarty::setErrorTemplate() – Sets the way elements with validation errors are rendered

Synopsis

require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';

void HTML_QuickForm_Renderer_ArraySmarty::setErrorTemplate ( string $template )

Description

You can use {$label} or {$html} placeholders to let the renderer know where where the element label or the element html are positionned according to the error message. They will be replaced accordingly with the right value. The error message will replace the {$error} placeholder. For example: {if $error}<span style="color: red;">{$error}</span>{/if}{$html} will put the error message in red on top of the element html.

If you want all error messages to be output in the main error block, use the {$form.errors} part of the rendered array that collects all raw error messages.

If you want to place all error messages manually, do not specify {$html} nor {$label}.

Groups can have special layouts. With this kind of groups, you have to place the formated error message manually. In this case, use {$form.group.error} where you want the formated error message to appear in the form.

Parameter

string $template

The element error template

Throws

throws no exceptions thrown

Note

This function can not be called statically.

Constructor (Previous) Sets the way required elements are rendered (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.