Skip to content

anchorchat/anchor-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anchor validation

Build Status

Module for exposing a few validation methods to be used in redux-forms.

Usage

Install from npm

NPM

Examples

import { maxLength, minLength, required, isAlphanumeric } from 'anchor-validation';

<form>
  <Field
    name="username"
    component={renderField}
    label="username"
    type="text"
    validate={
      [
        value => required(value, 'required'),
        value => minLength(2)(value, 'error_min_length'),
        value => maxLength(15)(value, 'error_max_length'),
        value => isAlphanumeric(value, 'error_not_alphanumeric')
      ]
    }
  />
  <Button onClick={handleSubmit(onSubmit)} disabled={invalid || submitting}>
    <p>Sign in</p>
  </Button>
</form>

About

Validation module for Anchor.Chat

Resources

License

Stars

Watchers

Forks

Packages

No packages published