Closed gredek closed 5 years ago
seems like the select2 field is also being validated because it status is 3. Still figuring out why the status has changed to 3 by the validation event on another field.
ok seem to found it. the validation happend because in yii.activeForm.js a forcevalidate is enabled on the field because of this.value !== getValue($form, this) is true and with multiple option active on the select2 widget it is comparing arrays, not value, therefore the widget got triggered to validate.
Hi,
When using the select2 widget in a ActiveForm, configured with the 'multiple' => true option, the widget validation gets triggered automatically by the validation event/process of any other field on the form.
Reproduce: So If you have a textinput field and a select2 field (configured with the multiple option) on your form (enableClientValidation true) and both are required, when validation on the textinput kicks in , the validation on the select2 is triggerd. When I remove the 'multiple' => true option from the select2 widget, the validation is not triggered by another field, behaves as expected.
any idea what could cause this and how to fix it? Thank you.