Validations / Standard validations

Validatable module in Webface.js provides a number of useful validations that are automatically avaialble to all instances of Component class (because the Validatable module is included in it). To clarify, it's not just FormFieldComponent instances that can use validations, but all Webface.js components, standard or user-defined:

Below is the list of validations you can add to any Webface.js component, described as name, [argument type]:

  • Numeric validations
    • isNumeric, [Boolean]
    • isLessThan, [Number]
    • isMoreThan, [Number]
  • Collection/ENUM validations
    • isOneOf, [Object]
    • isNotOneOf, [Object]
  • String validations
    • isLongerThan, [int]
    • isShorterThan, [int]
    • hasExactLengthOf, [int]
    • matches, [RegExp]
    • isNotNull, [Boolean]
    • isNotEmpty, [Boolean]