Hello.
FYI - I have Zero coding knowledge. Whatever i have written here is just 2 weeks of reading, back and forth. I apologize for silly syntax errors.
I’m running a website where the RSVP button has to be disabled once the required seats are filled up.
2 Collections
- a) Screenings - All screening details
- b)RSVP - User information being stored
RSVP button is on ‘ScreeningsTItle’ page (Dynamic Page - Screenings Dataset) with all info including venue details.
Input forms are on ‘Screenings RSVP’ (Dynamic Page - Screenings Dataset) - with Venue details input based on which venue page they came from.
I’m trying to sum up the total no. of seats (“Guests” field) but this has to be filtered by each venue -
I can’t seem to get this to work.
Right now I’m looking to only understand how to create a filter - and later worry about setting up a count/summation to enable/disable RSVP Button.
FullCode here -
$w.onReady( function () {
let currentItem = $w(‘#dynamicDataset’).getCurrentItem();
// RSVP ENABLE using Boolean in Dynamic Dataset, checkbox in collection
if (currentItem.rsvpboolean === true ){
$w(‘#button5’).enable();
}
//RSVP Button Redirect
$w(‘#button5’).link = “/Screenings/” + currentItem.title + “/rsvp”;
//Facebook Event button Enable
if (currentItem.eventYes){
$w(“#button1”).enable();
}
//creating query
// Why can’t I call information from Dynamic Dataset?
let RSVPVenue = currentItem.venue;
wixData.query(“RSVP”).eq(“title”, RSVPVenue.value)
.find()
.then((results) => {
let items = results.items
console.log(items)
})
// Query for filtering out guests who have entered value 1 - WORKS
//Only for testing, example code
wixData.query("RSVP").eq("guests", 1)
.find()
.then((results) => {
let test = results.length
console.log(test)
})
});