Skip to content
Myles Megyesi edited this page Oct 6, 2012 · 6 revisions

Usage

(defvalidator user-validator
  [:zipcode :length {:equal-to 5}])

(user-validator {:zipcode "1234"})
; {:zipcode ["is not equal to 5"]}

(user-validator {:zipcode "12345"})
; {}

Options:

Same as numericality.

Default error messages:

  • :is-not-greater-than``"must have length greater than %s".
  • :is-not-greater-than-or-equal-to``"must have length greater than or equal to %s".
  • :is-not-equal-to``"must be eqaul to %s".
  • :is-equal-to``"must not be eqaul to %s".
  • :is-not-less-than``"must be less than %s".
  • :is-not-less-than-or-equal-to``"must have length less than or equal to %s".
  • :is-not-odd``"must have odd length".
  • :is-not-even``"must be even length".
  • :is-not-in"must have length included in the list"`.
  • :is-in``"must have lenght not included in the list".
Clone this wiki locally