How to make a form collect text from a repeater?

Hi everyone! I’ve been researching this for a while, but couldn’t find out. In the site I’m building I have a simple repeater that contains a “TITLE” text and a button called “select service”. the repeater is already connected to a dataset that contains the titles.

What I need now is that when people click the buton “select service”, the text in the “TITLE” of that single cell of the repeater I click gets add to a userinput of a form bellow.

For now I got half it working as this:


import wixLocation from 'wix-location';

$w.onReady(function () {    
    $w("#repeater1").onItemReady( ($w, itemData, index) => {
        $w("#text39").text = itemData.TITLE;

        $w("#selecSERV").onClick((event,) => {
            $w("#colector").value = $w("#text39").text;
            $w("#Aform").scrollTo(); // anchor like
   });
} );
})

It works fine, but i really would like to make it accumulative. Right now it only got a service for click and it will substitute the older each time i got a new one. I need that each time client click in a “select” buttons, they ad it int he box with a comma. This way if a client wants to select various itens from the list, its possible to send they all in one form submission.

pss: edited this post as I would gathering answers form otrer sources

See how things are right now:

Hi,

Try using an additional repeater. On every click, the title should be pushed to the second repeater’s data.
Consider also adding a remove button to allow users to delete items from the second repeater.

$w("#selecSERV").onClick((event,) => {
            $w("#repeaterTwo").data = //Push the selected item to the repeater data. 
   });

See more here.
https://www.wix.com/corvid/reference/draft/$w.Repeater.html#data