Skip to content
New issue

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

Add docs about dynamic validators #17

Open
franleplant opened this issue Jan 31, 2017 · 0 comments
Open

Add docs about dynamic validators #17

franleplant opened this issue Jan 31, 2017 · 0 comments

Comments

@franleplant
Copy link
Owner

After talking to one of our first users we came up with a use case where he was using minNumber but he needed that the argument to be bound to another field. This was the best solution we came up with:

validationRules = {
  priceMax: {
    minNumber: value => validators.get('minNumber')(value, this.state.fields.priceMin)
  }
}

The idea is to document this case in the readme. The solution is basically that.
We use the already existing validator but we use it dynamically by overwriting it with it's own function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant