form validation done

This commit is contained in:
Sukchan Lee 2017-06-29 19:20:41 +09:00
parent 5c37e0e874
commit 7b87076e59
2 changed files with 3 additions and 5 deletions

View File

@ -122,8 +122,6 @@ const transformErrors = errors => {
});
};
const log = (type) => console.log.bind(console, type);
class Form extends Component {
static propTypes = {
visible: PropTypes.bool,
@ -169,7 +167,7 @@ class Form extends Component {
}
handleChange = data => {
const { formData, status, errors } = data;
const { formData, errors } = data;
let disableSubmitButton = (errors.length !== 0);
// I think there is a library bug React or Jsonschema
@ -225,8 +223,7 @@ class Form extends Component {
transformErrors={transformErrors}
autocomplete="off"
onChange={handleChange}
onSubmit={() => onSubmit(this.state.formData)}
onError={log("errors")}>
onSubmit={() => onSubmit(this.state.formData)}>
<div>
<button type="submit" ref={(el => this.submitButton = el)}/>
<style jsx>{`

View File

@ -45,6 +45,7 @@ class Document extends Component {
handleSubmit = (formData) => {
console.log(formData);
this.props.onHide();
}
render() {