Hi, I am not a coder and use this community to solve issues I face when developing in Editor X. I already found the solution to my initial requirement but I am missing a last bit.
I created a custom input form (https://claudiolimongi.editorx.io/new-dawn-travel/get-a-quote) using also Selection Tags. I already found a piece of code allowing me to make a single selection. I found the code here → Selection Tags - Single Selection, written by @CODE-NINJA. Thanks for that.
In frontend works well, but I have a problem on backend, in the database. Each of the selection tags fields are populated with the last 2 (two) I touched - even if on the frontend I have only one selected. For example, if in the first question ( Which destination interests you the most? ) I click on “Another Country”, then on “France”, then on “Spain” and then on “Italy” → the database will be populated with Spain and Italy (and I only need Italy there).
This is the code I am using
$w.onReady(function () {
$w('#selectionTags1').onChange(()=>{
let VALUE = $w('#selectionTags1').value
let LENGTH = VALUE.length
console.log(LENGTH)
for (var i = 0; i < LENGTH-1; i++) {
if(LENGTH>1) {
VALUE.shift()
}
else{ }
}
console.log(VALUE)
setTimeout(()=>{
$w('#selectionTags1').value = []
$w('#selectionTags1').value = VALUE
},1)
})
});
And this is how the database gets populated (the erros repeats in all selection tags fields I have)
I appreaciate your help!
Thanks