Semantic-ui: Dropdown not validating on blur or change events

Created on 12 Feb 2015  路  8Comments  路  Source: Semantic-Org/Semantic-UI

I dont know if this is for a particular reason, but i cant seem to get a dropdown box to validate on blur or change events. It does validate correctly upon form submit.
All semantic-ui demo code for form validation also has this, so no demo code needed i suppose.

Confirmed Bug

Most helpful comment

Still seeing the 'blur' problem in 2.3.1 and on the examples page.

Im using this for now:

  $('.ui.dropdown').on('blur', function () {
    setTimeout(function ($e) { $e.find('input,select').trigger('blur') }, 1, $(this))
  })

The setTimeout is there to avoid a flash of the error prompt when selecting a value. Hope someone else finds it useful.

All 8 comments

Any update on the issue ?
Here is a jsfiddle that duplicates the error : http://jsfiddle.net/8wm6uoth/18/
All elements validate trough blur, only dropdown doesn't, still validates on submit tho.

I'll try to sneak this in 1.9

awesome, thanks :+1:

everything seems fine now, thanks for the fix :+1:

I am still having this issue with Semantic-ui 2.1.5. only dropdown doesn't validate onBlur.
I am using semantic ui with React framework.
Demo site seems to have same issue too.
http://semantic-ui.com/behaviors/form.html#/examples

Echoing @utsavig, dropdown doesn't validate on blur.

I'm using semantic-ui-dropdown npm package. To fix @utsavig problem, I added :

$input.trigger('blur');

to the blur method on line 927

blur: function(event) {
   $input.trigger('blur');
      pageLostFocus = (document.activeElement === this);
      if(!activated && !pageLostFocus) {
         module.remove.activeLabel();
            module.hide();
     }
}

Still seeing the 'blur' problem in 2.3.1 and on the examples page.

Im using this for now:

  $('.ui.dropdown').on('blur', function () {
    setTimeout(function ($e) { $e.find('input,select').trigger('blur') }, 1, $(this))
  })

The setTimeout is there to avoid a flash of the error prompt when selecting a value. Hope someone else finds it useful.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

batata004 picture batata004  路  3Comments

guilhermeblanco picture guilhermeblanco  路  3Comments

sarbona picture sarbona  路  3Comments

vinhtq picture vinhtq  路  3Comments

ghost picture ghost  路  3Comments