moeen-basra / ree-validate

Simple React.js input validation plugin extended from vee-validate
MIT License
16 stars 4 forks source link

How to pass options parameters? #4

Closed ctkc closed 6 years ago

ctkc commented 6 years ago

Hello!, I need translate the errors messages. I reed the vee-validate documentation but I don't know how to set up the options object here.

Thanks!

moeen-basra commented 6 years ago

When creating an instance you can pass 2nd parameter as options

valentinfily commented 6 years ago

Still not clear how this works.

I tried:

this.validator = new Validator({ email: 'required|email', password: 'required|min:3', }, {locale: 'fr'});

But it did not work. thanks

moeen-basra commented 6 years ago

please follow the steps to localize the errors

import { Validator } from 'ree-validate'
import fr from 'ree-validate-dev/dist/locale/rf'

this.validator = new Validator({
// options
})
this.validator.localize('fr', fr)
ctkc commented 6 years ago

When I install the project through npm the only folder that exists is dist and there is no locale folder into that. Anyway I downloaded the files manually and I did what you said but still doesn't work. I receive 'define is not defined' and 'ReeValidate is not defined' when I import my locale file. Sorry for the delay.

Thanks!

moeen-basra commented 6 years ago

I have updated the readme make sure you follow