Hi everybody!
I’m using a function connected to Google Places API that autocompletes addresses based on user input.
It works pretty well, except when you input a character with an accent in the input field. In the console I then get the message that the .value of the input field is undefined. Of course it messes up the results of the autocomplete:
- When the address starts with an accent it does not show any suggestion
ex:
input: échirolles
suggestions: - When the address contains an accent, it stops autocompleting at the last character before the accent
ex:
input: hôpital
suggestions: Houston, Texas (so only based on the first letter H)
Does anybody knows a way to make the input field recognize characters with accents ?
Here is the part of my code:
export function inputAddress_input ( event ) {
autocomplete ( $w ( ‘#inputAddress’ ). value )
. then (( res ) => {
let predictions = res . predictions ; // For simplicity we put the predictions in a new variable
let suggestions = ; // We should create an empty array for the suggestions
predictions . forEach ( function ( prediction ) {
let item = { “_id” : getRandStr (), “address” : prediction . description };
suggestions . push ( item );
});
$w ( “#repeaterSuggestions” ). data = ; // clear the repeater contents
$w ( “#repeaterSuggestions” ). data = suggestions ; // add the new suggestions to the repeater
$w ( “#repeaterSuggestions” ). expand (); // Repeater is full now, let’s show it.
console . log ( Error )
console . log ( $w ( ‘#inputAddress’ ). value );
})
}
https://www.unciel.fr/products-1/pull
Thank you very much !