Added validation for framework forms.
This commit is contained in:
parent
80b9f5ddad
commit
53f034eb5f
1 changed files with 20 additions and 5 deletions
|
@ -217,6 +217,20 @@
|
|||
length = length + 1
|
||||
}
|
||||
if ( length > this.options.maxlength ) {
|
||||
|
||||
// try to set error on framework form
|
||||
parent = this.$element.parent().parent()
|
||||
if ( parent.hasClass('form-group') ) {
|
||||
parent.addClass('has-error')
|
||||
setTimeout($.proxy(function(){
|
||||
parent.removeClass('has-error')
|
||||
}, this), 1000)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// set validation on element
|
||||
else {
|
||||
this.$element.addClass('invalid')
|
||||
setTimeout($.proxy(function(){
|
||||
this.$element.removeClass('invalid')
|
||||
|
@ -224,6 +238,7 @@
|
|||
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue