Commit dbfc591b authored by Carsten  Rose's avatar Carsten Rose

Merge remote-tracking branch 'origin/marcTagInputBugFix' into F9517TagInput

parents ca32f7d0 65c7704d
......@@ -18,8 +18,6 @@
"use strict";
var disableHiddenUpdate = false;
var defaults = {
prefilled: null,
CapitalizeFirstLetter: false,
......@@ -87,7 +85,7 @@
}
// call the validator (if any) and do not let the tag pass if invalid
if (!ignoreValidator && opts.validator && !opts.validator(tag)) {
if (!ignoreValidator && opts.validator && !opts.validator(tag) && !opts.disableHiddenUpdate) {
$self.trigger('tm:invalid', tag);
return;
}
......@@ -304,8 +302,8 @@
},
refreshHiddenTagList: function () {
if (!disableHiddenUpdate) {
var $self = $(this), tlis = $self.data("tlis"), lhiddenTagList = $self.data("lhiddenTagList");
var $self = $(this), opts = $self.data('opts'), tlis = $self.data("tlis"), lhiddenTagList = $self.data("lhiddenTagList");
if (!opts.disableHiddenUpdate) {
if (lhiddenTagList) {
$(lhiddenTagList).val(tlis.join($self.data('opts').baseDelimiter)).change();
......@@ -399,6 +397,7 @@
opts.baseDelimiter = String.fromCharCode(opts.delimiterChars[0] || 44);
opts.tagBaseClass = 'tm-tag';
opts.inputBaseClass = 'tm-input';
opts.disableHiddenUpdate = false;
if (!$.isFunction(opts.validator)) {
opts.validator = null;
......@@ -536,7 +535,7 @@
};
$.fn.tagsManager = function (method) {
var $self = $(this);
var $self = $(this), opts = $self.data('opts');
if (!(0 in this)) {
return this;
......@@ -547,7 +546,7 @@
} else if (typeof method === 'object' || !method) {
return privateMethods.init.apply(this, arguments);
} else if (method === 'disableHiddenUpdate') {
disableHiddenUpdate = arguments[1];
opts.disableHiddenUpdate = arguments[1];
} else {
$.error('Method ' + method + ' does not exist.');
return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment