0.3.0 • Published 4 years ago

react-validated v0.3.0

Weekly downloads
102
License
SEE LICENSE IN LI...
Repository
github
Last release
4 years ago

react-validated

react

NPM JavaScript Style Guide

Install

npm install --save react-validated

Usage

Before:

  render () {
    return (
      <form onSubmit={this.onSave}>
        <input type="text" placeholder="Enter a Name"
          name="name" onChange={this.handleInputChange} value={this.state.name} />
        <button type="submit" className="btn btn-primary" data-background-color="orange">
          Save
        </button>
      </form>
    )
  }
}

After:

  render () {
    return (
      <ValidatedForm onSubmit={this.onSave}>
        <ValidatedInput required min-length={{ params: 5 }}>
          <input type="text" className="form-control" id="name" placeholder="Enter a Name"
            name="name" onChange={this.handleInputChange} value={this.state.name} />
        </ValidatedInput>
        <button type="submit" className="btn btn-primary" data-background-color="orange">
          Save
        </button>
      </ValidatedForm>
    )
  }
}

Note that onSubmit will only be triggered if validation passes.

License

LGPL-3.0 © Polymath Labs

0.3.0

4 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.1.0-alpha.1

6 years ago

0.0.1

6 years ago