Open uovidiu opened 7 years ago
@uovidiu since collection is array of forms, you need to provide the index of the field that you want to remove. So if you need to remove 2nd entry, something like this should work:
$form->addresses->removeChild(1);
Also note that i used removeChild
, since removeChildren
does not exist.
Still doesn't work.
I get that I need to pass the index.
$form->addresses->removeChild(0);
result in an empty form.
Everything else than 0 doesn't do anything.
How can I remove a field from AddressForm?
Here is my structure
AddressForm.php
I've tried $form->addresses->removeChildren('post_code') but doesn't work.
Is it possible? Because on a child element of type 'form' works without a problem.