kartik-v / yii2-widgets

Collection of useful widgets for Yii Framework 2.0
http://demos.krajee.com/widgets
Other
558 stars 175 forks source link

select2-widget: has-error class and has-success class are applied incorrectly #313

Closed jyann closed 8 years ago

jyann commented 8 years ago

The ".has-error" class is added to the select2 span element when it is removed from the parent div. Notice in the image below, the select2 span has class ".has-error" while it's parent element has class ".has-success" instead. This may be a race condition, though it has proven to be consistent for me so far.

screen shot 2016-08-02 at 3 54 36 pm

Steps to reproduce:

  1. Add a select2 widget to an ActiveForm with the clear option enabled
  2. Add Yii2 validation so the select2 field is required
  3. Select an item
  4. Clear the item so the required error appears
  5. Select an item again

At this point, you should see something like the screenshot included if you inspect element.

ilgiz-badamshin commented 8 years ago

+1

kartik-v commented 8 years ago

Duplicate to kartik-v/yii2-widget-select2#170 and closed via that.