Skip to content
vivin edited this page Jul 19, 2012 · 10 revisions

Overview

regula.Constraint is similar to an enum, and provides a convenient way to refer to constraints without using “magic” strings. Javascript does not have true enums, so technically Constraint is simply a map. Although the individual types in the map resolve to integer values, do not rely on the actual integer value. It is safer to use the enum.

Available types:

  • Required
  • Checked
  • Selected
  • Integer
  • Real
  • Max
  • Min
  • Range
  • Between
  • NotBlank
  • NotEmpty
  • Blank
  • Empty
  • Pattern
  • Matches
  • Email
  • Alpha
  • Numeric
  • AlphaNumeric
  • Length
  • Digits
  • Past
  • Future
  • CompletelyFilled
  • PasswordsMatch

Note: Whenever you add a custom constraint, Constraint is updated to contain your custom constraint. Therefore, if you had a custom constraint called MyCustomConstraint, you can then access it by doing regula.Constraint.MyCustomConstraint.

Clone this wiki locally