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?
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?
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:
If desired, you can also access the text as it is being entered using the onChange event handler: https://jsbin.com/moqogag/edit?js,output
class App extends React.Component {
constructor(props) {
super(props)
this.handleChange = this.handleChange.bind(this)
}
handleChange(e) {
console.log("CHANGING")
console.log(e.target.value)
}
render() {
return React.DOM.form({ onChange: this.handleChange, action: "" }, [
React.DOM.input({ type: "text" }),
React.DOM.input({ type: "text" })
])
}
}
ReactDOM.render(
React.createElement(App),
document.getElementById("app")
)