I have created a page that has input fields First Name and Last Name for my guests to enter. I also created a data collection titled “Wedding RSVP” that has the fields First and Last. I am trying to have guests enter their name, and once they press the “next” button, if the first and last name entered are correct (matches the first and last name in database), it will go to a dynamic page. Basically, I need it to go to a dynamic page if the 2 inputs are the same as the dataset.
I have tried using a code to make this happen, but I can’t seem to get it to work. Can anyone let me know where I am going wrong or help me out?
@jazzmin_d it depends on who should be able to read.
But according to your screenshot, you put the “import” line in the wrong place. It must be at the very top of your code (first line, before everything else. Event before the $w.onReady() )
I have made the necessary changes but still cannot get it to work.
Here is my code:
import wixData from ‘wix-data’; import wixLocation from ‘wix-location’;
export function button1_click(event, $w) {
setTimeout(() => { let input1 = $w(‘#input1’).value; let input2 = $w(‘#input2’).value;
}, 10); // 10 milliseconds works for me
} let input1 = $w(‘#input1’).value; let input2 = $w(‘#input2’).value;