|
@@ -168,7 +168,6 @@
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
this.options = $.extend(true, this.options, options);
|
|
this.options = $.extend(true, this.options, options);
|
|
|
- //console.log(this.options);
|
|
|
|
|
|
|
|
|
|
for (var field in this.options.fields) {
|
|
for (var field in this.options.fields) {
|
|
|
this._initField(field);
|
|
this._initField(field);
|
|
@@ -200,11 +199,6 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Set the attribute to indicate the fields which are defined by selector
|
|
|
|
|
- if (!fields.attr('data-bv-field')) {
|
|
|
|
|
- fields.attr('data-bv-field', field);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
var that = this,
|
|
var that = this,
|
|
|
type = fields.attr('type'),
|
|
type = fields.attr('type'),
|
|
|
event = ('radio' == type || 'checkbox' == type || 'file' == type || 'SELECT' == fields[0].tagName) ? 'change' : 'keyup',
|
|
event = ('radio' == type || 'checkbox' == type || 'file' == type || 'SELECT' == fields[0].tagName) ? 'change' : 'keyup',
|
|
@@ -217,6 +211,11 @@
|
|
|
// Allow user to indicate where the error messages are shown
|
|
// Allow user to indicate where the error messages are shown
|
|
|
$message = this.options.fields[field].container ? $parent.find(this.options.fields[field].container) : this._getMessageContainer($field);
|
|
$message = this.options.fields[field].container ? $parent.find(this.options.fields[field].container) : this._getMessageContainer($field);
|
|
|
|
|
|
|
|
|
|
+ // Set the attribute to indicate the fields which are defined by selector
|
|
|
|
|
+ if (!$field.attr('data-bv-field')) {
|
|
|
|
|
+ $field.attr('data-bv-field', field);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Whenever the user change the field value, mark it as not validated yet
|
|
// Whenever the user change the field value, mark it as not validated yet
|
|
|
$field.on(event + '.bv', function() {
|
|
$field.on(event + '.bv', function() {
|
|
|
updateAll ? that.updateStatus(field, that.STATUS_NOT_VALIDATED, null)
|
|
updateAll ? that.updateStatus(field, that.STATUS_NOT_VALIDATED, null)
|
|
@@ -308,7 +307,7 @@
|
|
|
}).join(' ');
|
|
}).join(' ');
|
|
|
|
|
|
|
|
for (var i = 0; i < total; i++) {
|
|
for (var i = 0; i < total; i++) {
|
|
|
- $(fields[i]).on(events, function () {
|
|
|
|
|
|
|
+ $(fields[i]).on(events, function() {
|
|
|
updateAll ? that.validateField(f) : that.validateFieldElement($(this), false);
|
|
updateAll ? that.validateField(f) : that.validateFieldElement($(this), false);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -507,8 +506,6 @@
|
|
|
$errors = $message.find('.help-block[data-bv-validator]'),
|
|
$errors = $message.find('.help-block[data-bv-validator]'),
|
|
|
$icon = $parent.find('.form-control-feedback[data-bv-field="' + field + '"]');
|
|
$icon = $parent.find('.form-control-feedback[data-bv-field="' + field + '"]');
|
|
|
|
|
|
|
|
- console.log(field, validatorName, status);
|
|
|
|
|
-
|
|
|
|
|
// Update status
|
|
// Update status
|
|
|
if (validatorName) {
|
|
if (validatorName) {
|
|
|
$field.data('bv.result.' + validatorName, status);
|
|
$field.data('bv.result.' + validatorName, status);
|