nullgr / react-validation-utils Goto Github PK
View Code? Open in Web Editor NEWValidate react form components, based on their state
Validate react form components, based on their state
I think we need to implement default rules for some cases, such as:
OR if you have some lightweight libraries that give such functional please link them there
In some cases input have 3 states(statuses) in design. These 3 states correspond to states saved in validationStorage, for now I can get status of field with such hack:
getFieldStatus = fieldName => {
const statuses = this.state.validationStorage[fieldName];
if (statuses.indexOf('validation-failed') !== -1) {
return 'validation-failed';
}
if (statuses.indexOf('prevalidation-failed') !== -1) {
return 'prevalidation-failed';
}
if (statuses.indexOf('validation-passed') !== -1) {
return 'validation-passed';
}
};
I think it will be cool to implement such method in Validator
And of course this hack works only in this version, in next version validationStorage will be hidden inside library, so we need to implement such method in feature/2.0 branch
Can you just give me an example if there are more than one form? How can we handle it separately? I have tried starting the state such as state={form1: Validator.addValidation({ username: '' });}
. But it was showing some error.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.