Sergei Basharov
Sergei Basharov

Reputation: 53920

Antd Form doesn't submit when there are more than one text input inside

I have a simple example where for some reason form stops calling onSubmit callback if I add more than one text inputs and push 'Enter' key while one of the inputs is focused.

Here is a link on CodePen: https://codepen.io/anon/pen/KePXOj?&editors=001.

This one works:

<Form onSubmit={(e)=>{e.preventDefault(); console.log(e)}}>
    <Input/>
</Form>

And this doesn't:

<Form onSubmit={(e)=>{e.preventDefault(); console.log(e)}}>
    <Input/>
    <Input/>
</Form>

What am I doing wrong there?

Upvotes: 1

Views: 754

Answers (1)

supra28
supra28

Reputation: 1636

This doesn't seem to be an antd issue, it is a known quirk that forms with only a single input fire onsubmit when pressing enter while if they have multiple inputs they do not.

This might be related

Upvotes: 0

Related Questions