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

Previous data gets lost on selection #40

Closed
turhn opened this issue Apr 17, 2014 · 3 comments
Closed

Previous data gets lost on selection #40

turhn opened this issue Apr 17, 2014 · 3 comments

Comments

@turhn
Copy link

turhn commented Apr 17, 2014

 <div id="tax-list" class="tag-list"></div>
            $.getJSON('/api/tax/', function (result) {
                var arr = new Array();
                for (var k in result) {
                    arr.push(result[k].TaxCode);
                }
                $('#tax-list').tags({
                    tagData: [],
                    restrictTo: arr,
                    suggestions: arr
                });
            });

When I initialize the tags just like the code above, for the first time it initializes perfectly. When I select an item from the suggestions list, the page refreshes and I lose the previously selected data.

@maxwells
Copy link
Owner

I'm confused as to why the page is refreshing when the item is selected. In this context (http://maxwells.github.io/bootstrap-tags.html) does it also refresh the page after selecting something? Does your code tell the page to refresh through some event handler?

Is the issue that the page is refreshing when a user clicks the suggestion or are you expecting the data to hang around from page to page?

@turhn
Copy link
Author

turhn commented Apr 17, 2014

I have just realised that the problem only occurs when I hit the enter button to select an item. I mean it is not actually refreshing the it's just posting the form and that causes refreshing.

If I update the situation :

How can I set the 'tags' to select suggested items by hitting the enter button without posting the entire form.

Sorry for the inconvenience.

@maxwells
Copy link
Owner

Got it. Thanks for clarifying. Yeah -- I had never tried to personally use it in a form. I've added an event.preventDefault() call that should work.

Newest version is 1.1.5: https://github.com/maxwells/bootstrap-tags/tree/1.1.5 -- reopen the issue if that doens't work for you

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

2 participants