Skip to content

Commit cb44a86

Browse files
committed
Merge pull request select2#374 from tzarger/master
Fix for ValidationEngine & hiding errors on change.
2 parents 12d1170 + 039f6b5 commit cb44a86

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

select2.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@
568568
this.body = thunk(function() { return opts.element.closest("body"); });
569569

570570
if (opts.element.attr("class") !== undefined) {
571-
this.container.addClass(opts.element.attr("class"));
571+
this.container.addClass(opts.element.attr("class").replace(/validate\[[\S ]+] ?/, ''));
572572
}
573573

574574
this.container.css(evaluate(opts.containerCss));
@@ -833,6 +833,11 @@
833833
// some validation frameworks ignore the change event and listen instead to keyup, click for selects
834834
// so here we trigger the click event manually
835835
this.opts.element.click();
836+
837+
// ValidationEngine ignorea the change event and listens instead to blur
838+
// so here we trigger the blur event manually if so desired
839+
if (this.opts.blurOnChange)
840+
this.opts.element.blur();
836841
},
837842

838843

@@ -2379,7 +2384,8 @@
23792384
return markup.replace(/&/g, "&");
23802385
}
23812386
return markup;
2382-
}
2387+
},
2388+
blurOnChange: false
23832389
};
23842390

23852391
// exports

0 commit comments

Comments
 (0)