Only first item in repeater is updated in database

Trying to build an RSVP type system.
Elements
#userinput1
#button1
#dataset1 (passcode(text), guestname(text), rsvp(bool),mealpref(text)
#repeater1 (hidden by default)
#guestnametext (text - #dataset1/guestnametext)
#rsvpcheckbox (user input - checkbox - #dataset1/rsvp)
#mealpref (user input - selection - #dataset1/mealpref)
#rsvpbutton (user input - #dataset1/submit)

Functionality:
(Good) User navigates to RSVP page. Presented with textbox (#userinput1), and #button1.

(Good)Places in passcode and hits #button1. Filter applied to #dataset1. Show #repeater1.

(Somewhat working, and acceptable) If #rsvpcheckbox is checked, show #mealpref. If #rsvpcheckbox is not checked hide #mealpref.
Problem - if #rsvpcheckbox is unchecked from being checked, then the #mealpref is NOT hidden

(Not working) #rsvpbutton button should save user input in ALL repeated items.
Problem - when using a submit button it only saves input from the first item in the repeater.


import wixData from ‘wix-data’;

$w.onReady( function () {
//TODO: write your page related code here…
$w(‘#dataset1’).onReady(() => {
$w(“#repeater1”).forEachItem( ($item, itemData, index) => {
if ($item(‘#rsvpcheckbox’).checked) {
$item(“#mealpref”).show();
} else {
$item(“#mealpref”).hide();
}
} );
$w(“#rsvpcheckbox”).onChange( (event, $w) => {
let $item = $w.at(event.context)
if ($item(‘#rsvpcheckbox’).checked) {
$item(“#mealpref”).show();
} if (!($item(“#rsvpcheckbox”))) {
$item(“mealpref”).hide();
}
});
});
});

export function button1_click(event) {
//Filter the database based on the user input
//Filtering should match the user input (provided personal passcode), and display all guests with same password in repeater
$w(‘#dataset1’).setFilter(wixData.filter().eq(‘passcode’, $w(‘#input1’).value));
setTimeout(() => {
$w(‘#guestrepeater1’).show();
$w(‘#rsvp’).show();
}, 500);
}

I went the easy route and placed a submit button as one of the repeated items and it works. Anyone can explain the background to that. I’m assuming the submit, when tied to the datastore submit functionality, essentially does a save (assuming based on log output). Reading save(), it only saves the current item. Is there a way that we have a single button to go through each item and save the user input to the corresponding element in the datastore?

Let me know if I need better explanation. I’ve got the functionality I want, just looking for efficiency, and also learning (new to Wix, some experience in C, python, very limited in OO programming, but quickly picking up the principles/concepts).