Can not use variable to define name in $form->addSelect()

4 years ago

OKweb
Member | 12
+
-2
-

Edit: It works, my mistake, I'm sorry!


I use Nette 2.3.0

This code for adding select to the form works:

$form->addSelect('volba16', $zlava->nazov, $polozky)->setDefaultValue('0');

This code does not work. When I submit the form, function $form->onSuccess[] is not executed:

$zlava->id = 16;
$form->addSelect('volba'.$zlava->id, $zlava->nazov, $polozky)->setDefaultValue('0');

But when I do it this way with Text input, it works, onsuccess function is executed:

$form->addText('volba'.$zlava->id, $zlava->nazov);

Last edited by OKweb (2015-04-24 13:06)