1.0.5 • Published 7 years ago

redux-form-validation-utils v1.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Creating Forms

To create form, use Redux-Form package http://redux-form.com/

Form validation

Short Form - Field validation

For short forms, which will not overflow user's viewport, we can use Field's validate prop along with validateField function and add an array of validator functions as an argument.

Example:

<Field
  name="username"
  validate={validateField([isRequired, isEmail])}
  label="Email"
  component={Input}
/>

Long Form - Form validation

If the form is too long to fit into the user's viewport we will use validateForm.

In order to get global error message with number of errors and ability to do the "error hopping", we also need to add the scrollToError function on onSubmitFail.

reduxForm({
  form: 'components',
  validate: validateForm({
   email: [isEmail, isRequired],
   password: [isRequired],
  }),
  onSubmitFail: scrollToError
})
1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago