Can't delete last element (v3.0.2)
slownet opened this issue · comments
Problem was on this version: v3.0.2
Composer: "webchemistry/forms-multiplier": "^3.0"
When I want to remove all elements with remove button, it's impossible to do that with the last element.
Component with name 'multiplier_remover' already exists.
Throws: Nette\InvalidStateException
`/** @var \WebChemistry\Forms\Controls\Multiplier $multiplier */
$multiplier = $form->addMultiplier('multiplier', function (Nette\Forms\Container $container, Form $form) {
$container->addTextArea('value');
}, 0);
$multiplier->setValues($defaultValues);
$multiplier->addCreateButton("Add")->addClass('btn_add');
$multiplier->addRemoveButton("Remove")->addClass('btn_remove');
On version 2.x it works.
Bug was solved in last commit. I release new version
Thank you for quick reply. I updated multiplier to last version and I don't see this error, but there is still error with the last element.
Now I can delete last element, but when I want to send this form, I can't do that, because it generates new required element with text:
Please select a valid option.
I haven't used setRequired
method.
Now it works with empty prompt: ->setPrompt('')
Can you try last commit? If it don't help, please send me code.
Hey, at version 3.0.3 i have same problem (after remove button its disapper, but after save and refresh its back). At last 2.x version and @dev it works fine.