Request: ability to set error message per pattern #174

mattpal opened this Issue Sep 19, 2013 · 1 comment


None yet

2 participants

mattpal commented Sep 19, 2013

It looks like right now the default error message on a pattern uses the pattern name (key), but it would be nice to have a separate error message for a couple of reasons:

  • It's nice to have the keys short and with no spaces in them. My case was wanting to validate a domain name, so ideally i'd have:
    domainName = /some regex/
    I ended up with:
    'domain name' = /some regex/
    which is okay except for the next problem:
  • It's really hard to localize (impossible really) since the key is used in the error

I could write a custom validator for this, but even the built in patterns I'd have to either write custom validators for or change the message to a generic "Field is not in correct format" or something like that.

I could write an extended pattern validator to do what I need too, but it seems like it might be functionality that other people would want.

Other than that, I love the library!

+1, I was about to log a request for allowing custom messages to be created for patterns.

@thedersen thedersen closed this in a23d796 Oct 31, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment