2016-05-12 17:42:04 -04:00
|
|
|
var classNames = require('classnames');
|
|
|
|
var Formsy = require('formsy-react');
|
|
|
|
var React = require('react');
|
|
|
|
var validations = require('./validations');
|
|
|
|
|
|
|
|
for (var validation in validations) {
|
|
|
|
Formsy.addValidationRule(validation, validations[validation]);
|
|
|
|
}
|
|
|
|
|
|
|
|
var Form = React.createClass({
|
2016-05-13 18:48:21 -04:00
|
|
|
getDefaultProps: function () {
|
|
|
|
return {
|
|
|
|
noValidate: true
|
|
|
|
};
|
|
|
|
},
|
2016-05-12 17:42:04 -04:00
|
|
|
render: function () {
|
|
|
|
var classes = classNames(
|
|
|
|
'form',
|
|
|
|
this.props.className
|
|
|
|
);
|
|
|
|
return (
|
|
|
|
<Formsy.Form {... this.props} className={classes}>
|
|
|
|
{this.props.children}
|
|
|
|
</Formsy.Form>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = Form;
|