Checkbox toggle issue
aleswita opened this issue · comments
Version: 3.0.1
Bug Description
When checkbox marked as required, condition with toggle evaluated always to true and JS hide HTML attribute with ID data every time, if checkbox checked or not.
If commented setRequired, behaviour is OK.
Steps To Reproduce
protected function createComponentForm(): Nette\Application\UI\Form
{
$form = new Nette\Application\UI\Form();
$form->addCheckbox('checkbox', 'checkbox')
->setOmitted()
->setRequired()
->addCondition(Nette\Forms\Form::EQUAL, false)
->toggle('data')
->endCondition();
return $form;
}
{form form}
<div id="data">
...
</div>
{input checkbox}
{/form}
It is fixed but you should use ->addCondition($form::BLANK)
.