User input edited through a repeater

Hiya Wix World,

I’m hoping someone can help me. I am not a web designer and have only just managed to do a little bit of coding, with much guidance.

I have built a website where members upload their own items to share on a public page (we are writers and they are sharing their books). Some of the members have more than one book, so I have created a repeater page where they can manage all their uploaded books (self inputted).

I used a dataset to connect to the collection and display all of an individual’s books. This worked very nicely. I set it to read-write and made it looged-in user only. This also worked nicely and we have a lovely page where they can see every book they’ve uploaded.

However, when they go to make changes, it only works on one of the elements. They can only edit one book (seemingly the first one they uploaded). I tried moving the submit button into the repeater, but that did not work either.

Is there something I need to do that will fix this? If they can’t edit more than one listing, then is it possible to filter a person’s books into a My Books page and then click on an individual listing and edit that listing? I can’t work out how to connect to an individual listing when the logged in user has more than one…??

Many thanks for any and all your help
Vicky

In this similar and actual parallel running post, you caould get your answer of how to solve your problem.

https://www.wix.com/velo/forum/community-discussion/how-to-change-the-colour-of-an-object-using-data

Yes it is an example with COLORS i know, but not far away from what you want to do.

I reconstructed this example by using an older example, which i have expanded a little bit to show how it works…

https://www.media-junkie.com/simple-repeater

$w.onReady(function () {
    $w("#repeater1").onItemReady( ($item, itemData, index) => {
        console.log(itemData)
        console.log(index)
        $item("#box1").style.backgroundColor = itemData.color
    } );
});

The REPEATER is of course connected with a COLLECTION by using a DATASET.

You have just to change it to your own needs.

For example you wanna click on one of the items in the repeater to start a changing event just for the item which was clicked, so an example for this would be like the following…

When clicking on a box inside repeater —> turn the color of the box → black…

$w.onReady(function () {
    $w("#repeater1").onItemReady( ($item, itemData, index) => {
        console.log(itemData)
        $item("#box1").style.backgroundColor = itemData.color
        $item('#box1').onClick(()=>{
            $item('#box1').style.backgroundColor = "black"
        })
    } );
});

Test it on the given example-site. :wink: