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

removeComponent() and getControls() in group #155

Closed
aleswita opened this issue May 30, 2017 · 4 comments
Closed

removeComponent() and getControls() in group #155

aleswita opened this issue May 30, 2017 · 4 comments

Comments

@aleswita
Copy link
Contributor

  • bug report? yes
  • feature request? no
  • version: 2.4.4

Description

I have no idea if is bug or intention. but if I remove component from form, component still exist in group controls.

Steps To Reproduce

protected function createComponentForm(): \Nette\Application\UI\Form {
	$form = new \Nette\Application\UI\Form;

	$form->addGroup("group1");

	$form->addText("input1");

	$form->addText("input2");

	$form->addSubmit("send1");

	$form->removeComponent($form["input1"]);

	bdump($form->getComponents());
	bdump($form->getCurrentGroup()->getControls());

	return $form;
}

@aleswita
Copy link
Contributor Author

This issue probably caused, why can not add component to the specific position with rendering with groups.

Expected output (without groups):

protected function createComponentForm(): \Nette\Application\UI\Form {
	$form = new \Nette\Application\UI\Form;

	//$form->addGroup("group1");

	$form->addText("input1", "input1");

	$form->addText("input2", "input2");

	$form->addSubmit("send1", "send1");

	$form->addSubmit("send2", "send2");

	$form->addComponent(new \Nette\Forms\Controls\TextInput("input3"), "input3", "send1");

	return $form;
}

Invalid inputs position (with groups):

protected function createComponentForm(): \Nette\Application\UI\Form {
	$form = new \Nette\Application\UI\Form;

	$form->addGroup("group1");

	$form->addText("input1", "input1");

	$form->addText("input2", "input2");

	$form->addSubmit("send1", "send1");

	$form->addSubmit("send2", "send2");

	$form->addComponent(new \Nette\Forms\Controls\TextInput("input3"), "input3", "send1");

	return $form;
}

@dg
Copy link
Member

dg commented Jun 19, 2017

Remove component from form really doesn't remove component from group. Due to the general concept of groups, this can not be changed in 2.4. So I added method remove() and removeOrphans() which removes unused controls.

@aleswita
Copy link
Contributor Author

@dg tnx!

For rendering problems, describe here: #155 (comment), do I create new issue?

@dg
Copy link
Member

dg commented Jun 19, 2017

Yes. It is much more complicated to solve.

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