Created
November 16, 2016 13:59
-
-
Save selvagsz/755ddf53255d9089754de147405c7da9 to your computer and use it in GitHub Desktop.
redux-form-validator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { reduxForm } from 'redux-form' | |
import { validator } from 'rzp/utils/validator' | |
@reduxForm({ | |
name: 'formName', | |
validate: validator({ | |
firstName: { | |
presence: true, | |
message: 'First name can\'t be blank', | |
}, | |
email: { | |
presence: true, | |
type: 'email', // supported types date,number,string | |
messages: { | |
presence: 'Email can\'t be blank', | |
type: 'Email is invalid' | |
}, | |
length: { | |
min: 3, | |
max: 10, | |
message: 'should be between 3 & 10', | |
messages: { | |
min: 'Can\'t be less than 3 chars', | |
max: 'Can\'t be more than 10 chars' | |
} | |
} | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment