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

Branching validation #6

Open
jacobemcken opened this issue Jul 11, 2014 · 0 comments
Open

Branching validation #6

jacobemcken opened this issue Jul 11, 2014 · 0 comments

Comments

@jacobemcken
Copy link

Right now you can "and" validations with the combine function. I'm looking for something which can "or" validations based on a predicate (including all the build-in stuff like required, not-blank etc.).

(verily/or #(= (:type %) "type1")
  (verily/combine
    (verily/not-blank [:type1-field])
    (verily/min-length 8 [:type1-field]))
  (verily/combine
    (verily/not-blank [:type2-field])
    (verily/matches #"[0-9]{4}" :type2-field)))

I would love to see an example as part of this site/project if something like the above is already possible, or for you to consider to implement something like it.

My use case is that I have a form with several fields which is only needs validation a specific to whether it's a private or a business customer signing up.

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