validateFormatOf

  • function
can.Map.validations.static.validateFormatOf  

observe.validateFormatOf(attrNames, regexp, options)

Parameters

  1. attrNames {Array<String>}

    Attribute name(s) to to validate

  2. regexp {RegExp}

    Regular expression used to match for validation

  3. options {Object}Optional

    Options for the validations. Valid options include 'message' and 'testIf'.

validateFormatOf(attrNames, regexp, options) validates where the values of specified attributes are of the correct form by matching it against the regular expression provided.

init : function(){
     this.validateFormatOf(["email"],/[\w\.]+@]w+\.\w+/,{
       message : "invalid email"
  })
}