can
Version:
MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.
21 lines (15 loc) • 714 B
Markdown
Map.validations.static.validateFormatOf validateFormatOf
can.Map.validations 2
`observe.validateFormatOf(attrNames, regexp, options)`
{Array<String>|String} attrNames Attribute name(s) to to validate
{RegExp} regexp Regular expression used to match for validation
{Object} [options] 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"
})
}
can.