Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirm on blur #55

Closed
haabe opened this issue Nov 8, 2013 · 6 comments
Closed

Confirm on blur #55

haabe opened this issue Nov 8, 2013 · 6 comments

Comments

@haabe
Copy link

haabe commented Nov 8, 2013

I guess this might not be much of an issue unless you use freeinput.

If a user types in a tag and then clicks outside the input field so that it loses focus, the typed in text is still text. I'd like an option to turn this text into a tag on blur.

An ugly workaround:
$('.bootstrap-tagsinput input').blur(function() {
$('.myinputfield').tagsinput('add', $(this).val());
$(this).val('');
});

@gkorland
Copy link

+1 (thanks for the workaround)

@cygnil
Copy link

cygnil commented Dec 19, 2013

Definitely +1 for this

@dkonayuki
Copy link

+1 nicely done

@nnavnyko
Copy link

I had a problem when i was using Bootstrap Tagsinput and Typehead.js. By default Tagsinput has property addOnBlur = true, but typehead override this. Resolution is something like this:

  //tags is a Bloodhound object. see http://timschlechter.github.io/bootstrap-tagsinput/examples/ 
  //about Typehead. There is the same problem, you can try to enter some string and blur

    $('input').tagsinput({
          typeaheadjs: {
            name: 'tags',
            displayKey: 'val',
            valueKey: 'val',
            source: tags.ttAdapter()
          }
    });
    $('input').tagsinput('input').blur(function() {
        $('input').tagsinput('add', $(this).val());
        $(this).val('');
    })

In this order. I'm sorry for my english, it's not good :)

@tim-peterson
Copy link
Contributor

addOnBlur should be noted in the documentation as an option.

@nezirz
Copy link

nezirz commented May 1, 2018

This worked in my case solution from @itsprdp here:
"https://github.com/bootstrap-tagsinput/bootstrap-tagsinput/issues/236"

A better way to clear the typeahead input after adding the tag.

self.$input.typeahead('val', '');

Add this line to the end of the add() function after line number 149 in the src file https://github.com/TimSchlechter/bootstrap-tagsinput/blob/master/src/bootstrap-tagsinput.js

Ref: twitter/typeahead.js#233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants