These are chat archives for erikras/redux-form

1st
Feb 2018
Patrick P. Henley
@ab18556
Feb 01 14:54
Hey guys, I tryied a couple of form validation library with redux-form and none seems to fit. I need one with custom error messages that would allow me to do conditional validation. Anyone know some cool validation library that works well with redux-form?
Tom
@traverse
Feb 01 14:55
it's quite easy to write your own validation
I believe there's even examples in the docs @ab18556
Patrick P. Henley
@ab18556
Feb 01 14:57
Yeah that's what I'm doing at the moment... but my forms are complex and my validation is starting to look like a mess... I was hoping for something that would clean it up a bit
Tom
@traverse
Feb 01 14:57
What's the messy part you're worried about?
Patrick P. Henley
@ab18556
Feb 01 15:02
my validation method... it has 200 lines of code at the moment with a lot of conditions. I tryied my best to keep it clean, but it is hardly maintainable... maybe I am doing something wrong tho
So what I understand is that writing our own validation is the prefered method with redux-form?
Tom
@traverse
Feb 01 15:03
you can write re-usable functions and hand them to individual fields
<Field component="input" type="text" validate={myValidationFunction} />
The signature of the validate function is as follows
validate : (value, allValues, props, name) => error
Patrick P. Henley
@ab18556
Feb 01 15:10
Ok I was validating on submit, I don't know if inline validation will help, but I can give it a try
Thx
Tom
@traverse
Feb 01 15:12
No problem