I have a form as below:
class AdminEmployerForm extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder
->add('firstName', 'text')
->add('user', new AdminUserForm());
}
}
class AdminUserForm extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder
->add('username', 'text')
->add('email', 'text');
}
}
I am calling AdminEmployerForm in controller and I want to remove email field of AdminUserForm from AdminEmployerForm:
$form = $this->createForm(new AdminEmployerForm, $employer);
//i want to do something like $form->remove('email')
how can i do use $form->remove() to remove field in embedded form? Is it possible to remove a field of embedded form from controller?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With