-
Notifications
You must be signed in to change notification settings - Fork 24
regula.Constraint
vivin edited this page Jul 19, 2012
·
10 revisions
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.
- Required
- Checked
- Selected
- Integer
- Real
- Max
- Min
- Range
- Between
- NotBlank
- NotEmpty
- Blank
- Empty
- Pattern
- Matches
- 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
.