API/libsapojs/SAPO/Utility/FormValidator

[Elements] are optional

Class SAPO.Utility.FormValidator


class SAPO.Utility.FormValidator

requires SAPO.Utility.Validator

requires SAPO.Dom.Css

Utility class to validate forms

Defined in Utility/FormValidator/0.1/lib.js

Function Summary
reset()
reset previously generated validation errors
Boolean validate (DOMElement|String elm, Object options)
Check if a form is valid or not

Function Details

function reset

reset()
reset previously generated validation errors

function validate

Boolean validate(DOMElement|String elm, Object options)
Check if a form is valid or not
Parameters:
elm - DOM form element or form id
options Options for
  • [ Function onSuccess ] - function to run when form is valid
  • [ Function onError ] - function to run when form is not valid
  • [ Array customFlag ] - custom flags to use to validate form fields
Returns:
true or false if the form is valid or not