Beginner issue: rendering forms

austerus
Member | 2
+
0
-

Hello,

I have a small project where I'm including standalone latte/latte, nette/forms and nette/utils.

Being a total n00b and all, I've tried to make a simple form and render it as per documentation with {control myForm} (also tried with {form myForm}{/form})

However, in both cases I get a Latte\CompileException saying “Unknown macro {form}, did you mean {for}” or “Unknown macro {control}”

Is there something I missed? I know I can just echo the form but I figured since I'm using latte anyway, I should go the documented way.

Thanks

F.Vesely
Member | 368
+
+3
-

You need register the {form} macro to Latte first before you can use it.

The easiest way to do that is through Nette\Bridges\FormsLatte\FormMacros class.

$latte = new Latte\Engine();
Nette\Bridges\FormsLatte\FormMacros::install($latte->getCompiler());