Can I add all the available tags of selectiontags to a database regardless of users selection? E.g show tag1, tag2, tag3 and tag4 of selectionTag1 in one database item.
Hello.
You can do this by declaring an array and assign an array of all the tags you have to the array then insert this to a collection. See sample code below:
$w("#selectionTags1").onClick((event) => {
let tags = ['tag1', 'tag2', 'tag3', 'tag4'];
let toInsert = {
"tags": tags
};
wixData.insert("myCollection", toInsert)
.then((results) => {
let item = results; //see item below
})
.catch((err) => {
let errorMsg = err;
});
});
Good luck!