I'm using a repeater to create a comments section, each comment has its own id, I'm trying to fetch each comment's individual id and insert it in a different collection by clicking on 'Click here'. The comments are stored in the 'Comunidad' collection and the id I'm trying to fetch needs to be inserted in the 'MeGusta' collection. Here's what's going on:
import wixData from 'wix-data';
export function text53_click() {
let myId = $w("#container1").id; // "myElement"
let toInsert = {
'Conversación':myId
};
// add the item to the collection
wixData.insert("MeGusta", toInsert);
}
The word 'container1' gets inserted in the database instead of the comment id.
Help please! :(
Thanx
ok so i've tried this also but .then is undefined?
I have a similar problem
I am trying to insert data from a repeater using the button on the repeater. This sends data into a collection which is assigned to the dynamic link
there are three fields in the repeater; country, countryFlags and continents.
Support has been awfully quiet due to this virus but would be great if someone could help please
Thanks
Adam
Hello Manny,
$w('#someElement').id will return the name of the element (in this case 'someElement' will be returned), which is not the information you want to get.
event.context.itemId
Try this:
import wixData from 'wix-data'; export function text53_click(event) { let myId = event.context.itemId; let toInsert = { 'Conversación': myId }; // add the item to the collection wixData.insert("MeGusta", toInsert); }
Is anyone there?
Hello?