Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkbox toggle issue #233

Closed
aleswita opened this issue Oct 31, 2019 · 1 comment
Closed

Checkbox toggle issue #233

aleswita opened this issue Oct 31, 2019 · 1 comment
Milestone

Comments

@aleswita
Copy link
Contributor

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}
@dg dg added this to the v3.1 milestone Apr 20, 2020
@dg dg closed this as completed in 48d6f2e Jun 5, 2020
@dg
Copy link
Member

dg commented Jun 5, 2020

It is fixed but you should use ->addCondition($form::BLANK).

dg added a commit that referenced this issue Jun 5, 2020
fixes addText()->setRequired()->addCondition(Form::BLANK)->toggle(), ie. condition after required
dg added a commit that referenced this issue Jun 6, 2020
fixes addText()->setRequired()->addCondition(Form::BLANK)->toggle(), ie. condition after required
dg added a commit that referenced this issue Jun 6, 2020
fixes addText()->setRequired()->addCondition(Form::BLANK)->toggle(), ie. condition after required
dg added a commit that referenced this issue Jun 6, 2020
fixes addText()->setRequired()->addCondition(Form::BLANK)->toggle(), ie. condition after required
dg added a commit that referenced this issue Jun 6, 2020
fixes addText()->setRequired()->addCondition(Form::BLANK)->toggle(), ie. condition after required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants