Skip to content

Group for fields #388

Open
Open
@oldy777

Description

@oldy777

Can I somehow add field in group? For example

$this->addGroup('my_group1', ['label' => 'My group'], function(){
    $this->add('text1', 'text');
})
$this->addGroup('my_group2', ['label' => 'My group2'], function(){
    $this->add('text2', 'text');
})

and render it

form_group('my_group1');
form_group('my_group2');

Now I try to do it with form type

$this->add('group', 'form', ['class'=>Myform::class])

But I'm facing with big problem, all names become name="form_name[field_name]". And no way to make simple name="field_name"

And another question, how can I add field after field in nested form?

$this->add('form_field', 'form', ['class'=>Myform::class])
$this->addAfter(''form_field.title', 'subtitle', 'text);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions