Query from collection to unique RSVP page

Disclaimer: I absolutely do not know how to code; my abilities are limited to inserting the smallest bit of code into a Tumblr theme back when I was a teenager.

I am creating a wedding website with Wix, and I want to be able to have an RSVP feature. I like this feature from Events, but I don’t like that I can’t create a guest list first without having to send out invitations. What I am trying to do is pull information from a guest list I created in Collections.

I have my RSVP page which has just an text input and a button. The idea is that whoever RSVPs will type in their name, and it will produce an actual RSVP page that includes them as well as other members of their party. They can then use radio buttons to indicate whether each person is coming or not. There is also a text box for dietary restrictions and song requests.

Right now, this is what this looks like:

import wixData from 'wix-data';

$w.onReady (function () {
    $w('#errortext').hide();
});

export function button1_onClick(event) {
    var name = $w('#input1').value;
    
    wixData.query('GuestList')
    .eq("title", name)
    .find()
    .then( (results) => {
        if(results.items.length > )) {
            $w('#input1').hide();
            $w('#button1').hide();
            }
        else {
            $w('#errortext').show();}
    })
}    

Obviously this is not complete, but when I type in a name into input1, regardless of whether it is one in the database or not, it just takes me back to the home page. I’m not sure the best way to pull this information from the database and populate it into a page.

Any help is greatly appreciated!!

GRATER than what ??? → than → 0 ???

if(results.items.length >)){ //<---- something missing here?????????
if(results.items.length > 0)){ ......

Also try to work more with → CONSOLE ! → always log your RESULTS!

.then((results)=>{console.log("My RESULTS: ", results);
..or even better ...
.then((results)=>{console.log("My RESULT-Items: ", results.tems);

Need some inspirations for your website?
Send me an message! You will find my contact in my Velo-Profile.