core-validation
    Overview
    Versions
    Jobs
    Chat
    Dependencies
    Contributors
    Documentation
    Alternatives
    Discussions

core-validation

core validation

0.0.15  •  Updated 1 years ago  •  by BclEx  •  MIT License

core validation for form state

Install

$ npm install core-validation --save

Example

import React from 'react';
import * as V from 'core-validation';

let Validator = V.create(new V.ReactBinding(), [
    V.rule('message', 'Message Body', V.required),
]);

export default class extends React.Component {
    constructor(props) {
        super(props);
        this.state = {};
    }
    inputChangeHandler = (e) => {
        // set state
        Validator(this).runRules();
    })
    submitHandler = (e) => {
        e.preventDefault();
        if (Validator(this).hasErrors()) return;
        // do submit
    }
    render() {
        let v = Validator(this);
        return (
            <div>
                <input id="message" error={v.errorFor('message')} label={v.labelFor('message')} onBlur={v.onBlurFor('message')} value={this.state.message} onChange={this.inputChangeHandler} />
                <button onClick={this.submitHandler}>Submit</button>
            </div>
        );
    }
}

reset

descrition of reset

export let reset = function ($this);

hasErrors

description of hasErrors

export let hasErrors = function ($this, rules, stateProp);

Popularity

Stars
0

Maintenance

Development

Last ver 1 year ago
Created 2 years ago
Last commit 1 year ago
11 days between commits

Technology

Node version: 10.13.0
198.6K unpacked

Compliance

MIT License
OSI Approved
0 vulnerabilities

Contributors

3 contributors
Sky Morey
Maintainer, 24 commits
Works at DEG
rbhojak
7 commits
Rishabh Bhojak
Maintainer, 2 commits
bvanasse
Maintainer
Patrick Delancy
Maintainer
Scott Pucket
Maintainer
Works at DEGDigital - Smarter Digital

Tags

validation
parse
format
form
Ready for the next level?
Join Openbase's founding team to help us build the ultimate open-source app store, work with the latest technologies, and enjoy great culture, impact and autonomy
Openbase helps developers choose among and use millions of open-source packages, so they can build amazing products faster.
FacebookLinkedIn
© 2020 Devstore, Inc.