Correction de l'encodage des suggestiosn

Fix #408
This commit is contained in:
Jean-Marie Favreau 2025-04-26 11:44:42 +02:00
parent 62688539e7
commit 349de37c7d

View File

@ -48,6 +48,11 @@
{% include "agenda_culturel/single-event/event-single-inc.html" with event=object noedit=1 %}
</article>
<script>
function htmlDecode(str) {
const doc = new DOMParser().parseFromString(str, "text/html");
return doc.documentElement.textContent;
}
const element = document.querySelector('#id_place');
const choices = new Choices(element, {
searchResultLimit: 10,
@ -57,7 +62,7 @@
choices.showDropdown();
setTimeout(() => {
const searchTerm = '{{ object.location }}';
const searchTerm = htmlDecode('{{ object.location }}');
choices.input.focus();
choices.input.value = searchTerm;
choices._handleSearch(searchTerm);