Ant Design Form field with array of objects

I want to edit an entity with one-to-many relation

{
  id: 1,
  title: 'Title',
  tags: [
    { id: 1 },
    { id: 2 },
  ],
}

With the code

<Form.Item
      name={["tags", "id"]}
    >

      <Select mode={'multiple'} {...selectProps} />
    </Form.Item>

On submit I get such object:

{
  id: 1,
  title: 'Title',
  tags: { id: [1, 2]},
}

How can I get tags as array of objects?

Upvotes: 1

Views: 2033

Answers (1)

nedosa
nedosa

Reputation: 46

Try using the normalize callback on Form.Item

Upvotes: 1

Related Questions