bassjobsen/Bootstrap-3-Typeahead

I can't get the selected element to show in the input

rafaxplayer opened this issue · 0 comments

Hi, I'm new to this library and it's working great except that when I select an item it doesn't print it in the input.
This is my code:
Javascript:
`$('#Autocomplete').typeahead({
source: function(query, process){

            $.ajax({
                url:"./php/autocomplete.php",
                type:"POST",
                data:{query,query},
                dataType:"json",
                async: true,
                success:function(data){
                    process($.map(data, function(item){
                        return JSON.stringify(item);
                    }));
                }
            })   
        },
        items: 10,
        highlighter: function(tema) {
		    var item = JSON.parse(tema);		
            var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
            return item.name.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
                return '<strong>' + match + '</strong>'
            }) ;
	    }, 
        updater: function(tema) {
            var item = JSON.parse(tema); 
            //$('#Autocomplete').val(item.name);      
            $('#PadreSlug').val(item.slug);
	    }
    })`

Html

`


Tema principal (Original)
Nombre del tema padre

<input name="padre" id="Autocomplete" autocomplete="off" data-provide="typeahead" class="form-control" type="text" value="" required>

        </div>`