Skip to content

Nested forms drawn field by field lose their full names #211

@Danita

Description

@Danita

Given the following form definition:

let formFilter = forms.create({
    filter: {
        uname: fields.string({
            label: 'Search by username or email',
        }),
        role: fields.array({
            label: 'By role',
            choices: { m: 'Moderator', g: 'Admin', a: 'Artist' },
            widget: widgets.multipleSelect()
        }),
    }
});

On the template side, if I draw the form using

 !=formFilter.toHTML(bootstrapField)

I get the following query:

{ filter: { uname: 'lala@example.com', role: [ 'm', 'g' ]} }

But if I draw the form fields individually (because of layout needs):

.row
    .col-lg-4
        !=formFilter.fields['filter'].fields['uname'].toHTML(null, bootstrapField)
    .col-lg-3
        !=formFilter.fields['filter'].fields['role'].toHTML(null, bootstrapField)

I get:

{ uname: 'lala@example.com', role: [ 'm', 'g' ]}

I would expect the input names to be derived from the form structure, regardless of how they are rendered. Is there any workaround? Thanks!

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