errorHelp
flexibility for showing multiple error messages from custom validation function
#28
Labels
errorHelp
flexibility for showing multiple error messages from custom validation function
#28
So I have a custom validation function for a password input, and want to show the user which of the four field validation rules the current value of the input is not meeting.
From what I can tell there is not support for doing this currently. I can return a string value from the validate function that gets displayed (awesome!), except for when I have multiple validation rules being broken, in which case my
errorHelp
text is just one long string which isn't too readable. I would like to have them on separate lines (really separate divs) like theerrorHelp
is displayed when you have multiple validation rules applied to an input that are from validator.js.I think a pretty awesome feature (which I'm willing to put time in to make a PR if it is well received), would be to try and look for the string that is returned from the validate function to match a key in the
errorHelp
object, and then display the corresponding value as the error message.For others that have had similar issues, I am getting around this for the moment by just passing jsx into the
errorHelp
prop. It breaks the propTypes, but it does work!Anyways, let me know what you think.
The text was updated successfully, but these errors were encountered: