rrag rrag - 1 month ago 7
React JSX Question

Reactjs: Form with multiple inputs does not submit

JSBin: https://jsbin.com/qotuxofalo/edit?js,output

(^ uses ES6 class, so please use a latest browser to test)

If I comment out the second

input
the form submits, but does not submit with more than 1
input
.

What am I missing?

Answer

You need to add a input of type submit to make the form work. Check the following examples. Adding that will submit the form on pressing enter. If you don't want that submit button, you can hide it using css.

Demo:

https://jsbin.com/mafafoxoji/1/edit?js,output

Comments