0

There's some kind of bug with connecting jQuery Validate to Select2: it doesn't automatically clear errors on typing, like it does with regular controls.

Therefore, I'm forced to do a manual on-change Clear on this field only (but not any others).

$('#approverReviewers').on('change', function (e) {
    //...
});

But how to do it? I don't want to do a Form-Reset, it's not the whole form.

And I don't like manual CSS removal: it's dirty and doesn't address the underlying internal Validation status, I assume? There are 2 separate parts (the field itself and its label) and I don't want to do it.

$(element).parent().removeClass('error');
$(element).remove();

Isn't there a better way?

Sparky
  • 98,165
  • 25
  • 199
  • 285
gene b.
  • 10,512
  • 21
  • 115
  • 227
  • Also see: https://stackoverflow.com/search?q=%5Bjquery-validate%5D+select2 – Sparky Aug 03 '18 at 14:39
  • Either write a jQuery event handler that programmatically validates this `select` (see duplicate), or modify the `highlight` and `unhighlight` functions to conditionally check the select. The former is easier to implement. – Sparky Aug 04 '18 at 00:14
  • Yeah it worked for me. That .valid() call for the on-change did the trick. thanks – gene b. Aug 05 '18 at 01:02

0 Answers0