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

Update tags when hidden field changes #72

Closed
vanmik opened this issue Mar 19, 2012 · 6 comments
Closed

Update tags when hidden field changes #72

vanmik opened this issue Mar 19, 2012 · 6 comments

Comments

@vanmik
Copy link

vanmik commented Mar 19, 2012

How to update tags, when tag-it input value has changed?

I want to do smth like that:

    <input name="tags" id="tags" value="hello, world" />
    $('#tags').tagit();

    $('#tags').val('hello,world,foobar');
    $('#tags').tagit('update'); // update tags based on input value

Maybe there is a fork with this feature?

@aehlke
Copy link
Owner

aehlke commented Nov 23, 2012

The ideal way is to call createTag instead of modifying the existing field. But if you must, can I suggest destroying the widget and re-instantiating it to refresh?

@aehlke
Copy link
Owner

aehlke commented Nov 25, 2012

Can you give me a use case for this? It seems like it might be unnecessary complexity. Going to close this for now unless someone convinces me otherwise, sorry.

@aehlke aehlke closed this as completed Nov 25, 2012
@codeling
Copy link

I might have a use case:
Environment: I have a list of items.
Use case: I want to edit one item.
For that I use a jquery dialog, which is dynamically filled with the values from the item to be edited.
Now to update the tag list with the values from the current item, ideally I would just have to fill the input and then call some update function, as described above.
I guess it would also be fine for that use case to destroy the widget and re-instantiating it - at the moment however I don't know how I would go about doing that (I am not so well-versed in jquery (ui) and javascript).
I thought of just calling tagit(...) again, but that doesn't seem to work - the tag list keeps the old values ...

@codeling
Copy link

@aehlke I know I'm reviving zombies here, but maybe you got a hint for me?

@codeling
Copy link

@aehlke never mind, in the meantime I worked around by removing and adding the tags with the provided removeAll/createTag methods!

@overallduka
Copy link

This is necessary, thanks codeling by the removeAll/createTag solution.

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

4 participants