We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi
Regarding this pull request #46
I expect the following code to work :
export const passwordFieldValidator = composeValidators( isRequired({ id: 'error.password.required', description: 'Error message password required', defaultMessage: 'You must provide a password' }), hasLengthGreaterThan(5)( id: 'error.password.required', description: 'Error message password required', defaultMessage: 'You must provide a password' }) )('password');
But It doesn't and I got the Error message :
Error: Please provide a string or configuration object with a `field` or `message` property
However, in order to work, I have to put a field property like this :
export const passwordFieldValidator = composeValidators( isRequired({ field: { id: 'error.password.required', description: 'Error message password required', defaultMessage: 'You must provide a password' } }), hasLengthGreaterThan(5)({ field: { id: 'error.password.required', description: 'Error message password required', defaultMessage: 'You must provide a password' } }) )('password');
If this is the case, it seems that the example in the documentation is not correct here http://revalidate.jeremyfairbank.com/usage/createValidator.html.
In the current documentation the example code is :
const requiredName = isRequired({ id: 'name', defaultMessage: 'Name is required', });
whereas it should be :
const requiredName = isRequired({ field : { id: 'name', defaultMessage: 'Name is required', } });
Am I correct or did I miss something ?
Best regards
The text was updated successfully, but these errors were encountered:
You're missing you must redefine all the validators you use to support i18n. Something like this:
export const format = (msg, fields={}) => (field) => ({field, msg, ...fields}); export const isRequired = createValidator(msg => value => { if(valueMissing(value)) return msg; },format(messages.isRequired));
Sorry, something went wrong.
Hi, @lauterry. This is definitely an error in the documentation that I must've missed. I'll fix the docs unless you want to open a PR.
@Zagitta I'm not sure your example would work in this case unless I'm missing something.
@jfairbank It would be nice to update the docs! :)
No branches or pull requests
Hi
Regarding this pull request #46
I expect the following code to work :
But It doesn't and I got the Error message :
Error: Please provide a string or configuration object with a `field` or `message` property
However, in order to work, I have to put a field property like this :
If this is the case, it seems that the example in the documentation is not correct here http://revalidate.jeremyfairbank.com/usage/createValidator.html.
In the current documentation the example code is :
whereas it should be :
Am I correct or did I miss something ?
Best regards
The text was updated successfully, but these errors were encountered: