0

I am using jquery-tokeninput as an autocomplete to retrieve some objects in my app. My js code to initialize the autocomplete is this:

function initialize_search(model, input_busca) {
    var url = reverse('autocomplete.'+model) + "?tipos[]=almoxarifado&tipos[]=estoque";
    var data = $(input_busca).data('tokeninput');
    $(input_busca).tokenInput(url, {
        hintText: 'Start to type',
        preventDuplicates: true,
        queryParam: 'name',
        noResultsText: 'No results',
        searchingText: 'Search',
        prePopulate: data
    });
}

All I want is to receive the parameter 'tipos[]' in my view, like this:

types = request.GET.getlist('tipos[]')

And receive this:

[u'almoxarifado', u'estoque']

But when i do this, he only gives me the last one and not all the list, in this case:

[u'estoque']

This is how I call the autocomplete function inside the js:

inicializa_busca('endereco', $("#id_enderecos"));
Henrik Andersson
  • 45,354
  • 16
  • 98
  • 92

1 Answers1

0

You must be aware that, ajax is to pass small data, check the size of this list, maybe is better an full post submission!

LottaLava
  • 889
  • 1
  • 9
  • 21
  • The list only have two items, I think that the problem is the tokenInput that proccess the url before he appends the data, but I not sure. – Vinicius Ramos Mar 28 '13 at 19:50
  • Yeah, i found someone with the same bug [here](https://github.com/loopj/jquery-tokeninput/issues/304), I think I will have to hack the code :( – Vinicius Ramos Mar 28 '13 at 19:56