Added validation for framework forms.

This commit is contained in:
Martin Edenhofer 2014-10-02 18:06:35 +02:00
parent 80b9f5ddad
commit 53f034eb5f

View file

@ -217,6 +217,20 @@
length = length + 1 length = length + 1
} }
if ( length > this.options.maxlength ) { 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') this.$element.addClass('invalid')
setTimeout($.proxy(function(){ setTimeout($.proxy(function(){
this.$element.removeClass('invalid') this.$element.removeClass('invalid')
@ -224,6 +238,7 @@
return false return false
} }
}
return true return true
} }