Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

Select not included in form when clearing tags #83

Open
louis opened this issue Mar 5, 2013 · 0 comments
Open

Select not included in form when clearing tags #83

louis opened this issue Mar 5, 2013 · 0 comments

Comments

@louis
Copy link

louis commented Mar 5, 2013

Hi everyone,

I just ran into an issue with tagit that excludes the select form element from being submitted when clearing a previously entered tag list. Has anyone else seen this issue? If so I'm curious to see the workaround. In the meantime I'll share mine below:

tagsChanged: function(tagValue, action, element) {
    var tags = TFW.widget.Tag.getTags($("#"+tagListContainer).tagit("tags"));
    if ($.isEmpty(tags)) {
        $("select[name='"+tagFormInputField+"']").append('<option selected="selected" value=""></option>');
    }
}

In a nutshell I'm simply adding an empty select option if the tag list has been cleared. Also, there's a bit of my own code such as $.isEmpty, which checks for empty string, and TFW.widget.Tag.getTags, which simply retrieves the tag list.

Thanks!

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

No branches or pull requests

1 participant