|
|
@@ -3,7 +3,7 @@
|
|
|
*
|
|
|
* A jQuery plugin to validate form fields. Use with Bootstrap 3
|
|
|
*
|
|
|
- * @version v0.3.0
|
|
|
+ * @version v0.3.0-dev
|
|
|
* @author https://twitter.com/nghuuphuoc
|
|
|
* @copyright (c) 2013 - 2014 Nguyen Huu Phuoc
|
|
|
* @license MIT
|
|
|
@@ -356,7 +356,8 @@
|
|
|
* Can be STATUS_VALIDATING, STATUS_INVALID, STATUS_VALID
|
|
|
*/
|
|
|
updateStatus: function($field, validatorName, status) {
|
|
|
- var field = $field.attr('name'),
|
|
|
+ var that = this,
|
|
|
+ field = $field.attr('name'),
|
|
|
validator = this.options.fields[field].validators[validatorName],
|
|
|
message = validator.message || this.options.message,
|
|
|
$parent = $field.parents('.form-group'),
|
|
|
@@ -384,10 +385,7 @@
|
|
|
// Add has-error class to parent element
|
|
|
$parent.removeClass('has-success').addClass('has-error');
|
|
|
|
|
|
- $errors
|
|
|
- .filter('[data-bs-validator="' + validatorName + '"]')
|
|
|
- .html(message)
|
|
|
- .show();
|
|
|
+ $errors.filter('[data-bs-validator="' + validatorName + '"]').html(message).show();
|
|
|
|
|
|
if (this.options.feedbackIcons) {
|
|
|
// Show "error" icon
|
|
|
@@ -402,7 +400,6 @@
|
|
|
$errors.filter('[data-bs-validator="' + validatorName + '"]').hide();
|
|
|
|
|
|
// If the field is valid
|
|
|
- var that = this;
|
|
|
if ($errors.filter(function() {
|
|
|
var display = $(this).css('display'), v = $(this).attr('data-bs-validator');
|
|
|
return ('block' == display) || (that.results[field][v] != that.STATUS_VALID);
|