contributte / forms-multiplier

:repeat: Form multiplier & replicator for Nette Framework
https://contributte.org/packages/contributte/forms-multiplier.html
MIT License
26 stars 21 forks source link

Component 'multiplier_remover' is not attached to 'Nette\Forms\Form' #16

Closed janholas closed 6 years ago

janholas commented 6 years ago

When using manual rendering of forms with groups and iterating over groups, I am getting InvalidStateException: Component 'multiplier_remover' is not attached to 'Nette\Forms\Form'

...
$form->addGroup("TEST");
$multi = $form->addMultiplier("multi", function(\Nette\Forms\Container $container, \Nette\Application\UI\Form $form) {
            $container->addText("a", "A");
        }, 1);

$multi->addCreateButton("Add");
$multi->addRemoveButton("Remove");
....

Latte:

{form testForm}
    {foreach $form->getGroups() as $groupName => $group}
        {foreach $group->getControls() as $name => $input}
             {input $input}
        {/foreach}
    {/foreach}
{/form}

This error doesn't happen when the form is rendered automatically or you itarate right over $form->getControls()

MartkCz commented 6 years ago

Sorry for late response. Thank you for issue