Handle on change in field

This commit is contained in:
lukasmartinelli
2016-09-12 20:29:53 +02:00
parent 7c7c8b7111
commit ae0a12dcd8
5 changed files with 25 additions and 8 deletions

View File

@@ -14,9 +14,14 @@ class NumberField extends React.Component {
doc: React.PropTypes.string,
}
onChange(e) {
return this.props.onChange(parseFloat(e.target.value))
}
render() {
return <Input type="number"
onChange={this.props.onChange}
return <Input
type="number"
onChange={this.onChange.bind(this)}
label={this.props.name}
name={this.props.name}
message={this.props.doc}