I am wanting to create a booking feature on my product pages. I have created a form that users must complete that is linked to a database and I am wanting it to automatically determine what product page the user is on and return this in my database when they submit the form to ensure the users booking details are submitted with the correct product.
In my database where the form is submitted to I have created 1 reference field that references the wix product database. However I am unable to get this to return correctly when the form is submitted.
This is the code I am currently using:
export function submitBook_click(event) {
$w(‘#productPage’).getProduct()
.then( (product) => {
let ProductName = [product.name;](product.name;
wixData.insert(“Book”)
}
)
[wixData.insert(“Book”)](product.name;
wixData.insert(“Book”)
}
)
[}](product.name;
wixData.insert(“Book”)
}
)
Thanks