1.0.6 • Published 7 years ago
react-form-controlled-validate v1.0.6
React controlled form validate
Validation of the forms. High order components for react-form-controlled. It is based on JSON Schema.
Simple arrays
If you are using fieldset with simple array do not enter the name attribute.
import React, { Component } from 'react';
import Form from 'react-form-controlled';
import Validate, { Alert } from 'react-form-controlled-validate';
const schema = {
type: 'object',
required: ['firstName'],
firstName: {
username: {
type: 'string',
minLength: 2,
},
},
};
export default class Example extends Component {
constructor(props, context) {
super(props, context);
this.state = {};
}
onSubmit = (data) => {
alert(`Hi ${data.firstName}`);
}
render() {
return (
<Validate schema={schema}>
<Form
value={this.state}
onSubmit={this.onSubmit}
>
<input name="firstName" />
<Alert name="firstName" />
<button type="submit">Submit</button>
</Form>
);
}
}
Support us
Star this project on GitHub.
Try our other React components
- Translate your great project react-translate-maker
- Google Analytics react-g-analytics
- Google AdSense via Google Publisher Tag react-google-publisher-tag
License
The MIT License (MIT)
Copyright (c) 2016 Zlatko Fedor
1.0.6
7 years ago
1.0.5
8 years ago
1.0.4
8 years ago
1.0.3
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago
0.1.14
8 years ago
0.1.13
8 years ago
0.1.12
8 years ago
0.1.11
8 years ago
0.1.10
8 years ago
0.1.9
8 years ago
0.1.8
8 years ago
0.1.7
8 years ago
0.1.6
8 years ago
0.1.5
9 years ago
0.1.4
9 years ago
0.1.3
9 years ago
0.1.2
9 years ago
0.1.1
9 years ago