Beta 3 Autocomplete with AJAX error in console


#1

error:

TypeError: e.value.replace is not a function. (In ‘e.value.replace(/"/g,""")’, ‘e.value.replace’ is undefined)


#2

Hey DEV!

See what the value is before giving a replace

try it
console.log(e.value)


#3

download v3.0.0-beta.8 and test the autocomplete ajax at the end of the autocomplete and you will see this error coming up in the console… here the screen capture!

and this is the code taken from the self.autocompleteStandaloneAjax

// Standalone With Ajax
self.autocompleteStandaloneAjax = app.autocomplete.create({
openIn: ‘page’, //open in page
openerEl: ‘#autocomplete-standalone-ajax’, //link that opens autocomplete
multiple: true, //allow multiple values
valueProperty: ‘id’, //object’s “value” property name
textProperty: ‘name’, //object’s “text” property name
limit: 50,
preloader: true, //enable preloader
source: function (query, render) {
var autocomplete = this;
var results = [];
if (query.length === 0) {
app.render(results);
return;
}
// Show Preloader
autocomplete.preloaderShow();
// Do Ajax request to Autocomplete data
app.request({
url: ‘./assets/js/autocomplete-where.json’,
method: ‘GET’,
dataType: ‘json’,
//send “query” to server. Useful in case you generate response dynamically
data: {
query: query
},
success: function (data) {
console.log(data);
// Find matched items
for (var i = 0; i < data.length; i++) {
if (data[i].name.toLowerCase().indexOf(query.toLowerCase()) >= 0) results.push(data[i]);
}
// Hide Preoloader
autocomplete.preloaderHide();
// Render items by passing array with result items
app.render(results);
}
});
},
on: {
change: function (value) {
var itemText = [],
inputValue = [];
for (var i = 0; i < value.length; i++) {
itemText.push(value[i].name);
inputValue.push(value[i].id);
}
// Add item text value to item-after
$(’#autocomplete-standalone-ajax’).find(’.item-after’).text(itemText.join(’, ‘));
// Add item value to input value
$(’#autocomplete-standalone-ajax’).find(‘input’).val(inputValue.join(’, '));
},
},
});


#4

Could be a bug, will check it


#5

thanks for checking it!