Skip to content

Dropdown in Array Field is always showing undefined #177

@vbhanuc87

Description

@vbhanuc87

Hi There,

I am having an issue when using shadcn/ui components and autoform to render a form based on zodSchema, that has an element with object array.

The form is rendering as expected, however, while saving the form - the value for dropdown field is always undefined, though a value is chosen in the dropdown.

Image

const schema = z.object({
name: z.string(),
contacts: z.array(z.object({
type: z.enum(['email', 'phone', 'fax', 'other']).default('email'),
value: z.string(),
label: z.string().optional(),
}))
});

Submit values received:

Image

Appreciate any help in this regards. I was combing through the code, but couldn't find the root cause for this.

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