import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
// Assume your form is a Lightbox
$w.onReady(function () {
// Event handler for form submission
$w("#submitButton").onClick(() => {
// Get user details
const user = wixUsers.currentUser;
user.getEmail()
.then((email) => {
user.getRoles()
.then((roles) => {
const role = roles[0]; // Assuming there's at least one role
const name = $w("#nameInput").value; // Get name from input field
const email = $w(“#email).value; // Get email from input field
// Generate Jotform prefill URL
const formURL = `https://form.jotform.com/241645490601150${encodeURIComponent(name)}&email=${encodeURIComponent(email)}`;
// Redirect to the Jotform
wixLocation.to(formURL);
});
});
});
});