Web Component: j-Validation


  • Info
  • HTML
  • JS
  • CSS
  • Meta

j-Validation

Configuration:

  • if {String} can contain JS condition for evaluation
    • value {Object} contains entire model
    • path {String} contains changed path
    • must return boolean
  • selector {String} jQuery selector for disabling (default: button[name="submit"])
  • delay {Number} a timeout for validation (default: 100)
  • flags {String} flags for better validation, can contain visible,hidden,enabled,disabled components
    • enabled validate all components which are enabled input, textarea or select elements
    • disabled validate all components which are disabled input, textarea or select elements
    • hidden validate all components which are hidden
    • visible validate all components which are visible
  • track {String} can contain paths divided by the comma, and manual changing of each path (via SET(), UPD(), INC(), etc. methods) will evaluate the validation
  • validonly {Boolean} skips dirty state (default: false)
  • NEW changes {Boolean} enables comparing changes only between the input model and the form (default: false)
  • NEW strictchanges {Boolean} enables strict comparing changes (otherwise null, false, empty strings and 0 values will be removed), default: false

Good to know:

  • component adds ui-validation-ok class to the element if the model is valid
  • component adds ui-validation-no class to the element if the model is invalid
  • component adds ui-validation-modified class to the element if the model is changed

Author