How to render form errors via Latte?
Notice: This thread is very old.
- MartyIX
- Member | 217
There's an example of rendering form in pure PHP and with the help of Latte engine: https://doc.nette.org/en/forms#…
The samples are almost identical but there's not written how to write in Latte this part:
<?php $form->render('errors') ?>
How can it be done?
Thanks!
- HosipLan
- Moderator | 4668
There is no such macro. You can either go for
{$form->render('errors')}
which will always work, because macro
{form}
does define variable $form
.
But those macros strictly don't use default form renderer. So it would be better to define own macro or render it like this
<ul class="errors" n:if="$form->hasErrors()">
<li n:foreach="$form->errors as $error">{$error}</li>
</ul>
Last edited by HosipLan (2011-08-14 08:37)