diff --git a/src/components/forms/form.jsx b/src/components/forms/form.jsx index 00c5487c4..d93495337 100644 --- a/src/components/forms/form.jsx +++ b/src/components/forms/form.jsx @@ -1,5 +1,6 @@ var classNames = require('classnames'); var Formsy = require('formsy-react'); +var omit = require('lodash.omit'); var React = require('react'); var GeneralError = require('./general-error.jsx'); var validations = require('./validations.jsx').validations; @@ -11,17 +12,27 @@ for (var validation in validations) { var Form = React.createClass({ getDefaultProps: function () { return { - noValidate: true + noValidate: true, + onChange: function () {} }; }, + getInitialState: function () { + return { + allValues: {} + }; + }, + onChange: function (currentValues, isChanged) { + this.setState({allValues: omit(currentValues, 'all')}); + this.props.onChange(currentValues, isChanged); + }, render: function () { var classes = classNames( 'form', this.props.className ); return ( - - + + {this.props.children} );