1

I have form:

enter image description here

My code to Tag1 look like:

$builder
        ->add('tag1', 'collection', [
            'type'   => 'text',
            'label' => 'Tag1',
            'allow_add'         => true,
            'allow_delete'      => true,
            'prototype'         => true,
            'options'           =>
                [
                    'required'  => false,
                    'label'     => false
                ]
        ])

But how add Sub form in field? Thanks!

Ivan
  • 2,463
  • 1
  • 20
  • 28

1 Answers1

1

Hi i think it's quite simple.

$builder
    ->add('tag1', 'collection', [
        'type' => new yourSubFormType(),
        ...
    ])

more information : http://symfony.com/doc/current/cookbook/form/form_collections.html

pietro
  • 902
  • 10
  • 22