I’m working on a website where we pull videos from a CMS into a Repeater (displaying 10 at a time). When the user clicks a button (to purchase) in the Container, a lightbox (popup) opens with a form and I need to seed it with the Video Title & Date and also the User Login / Customer information to help with the purchase.
The code on the page with the repeater / container is
import wixWindow from 'wix-window';
import * as wixData from '@wix/data';
$w.onReady(function () {
$w("#Section2Repeater1").onItemReady(($item, itemData, index) => {
$w('#button97').onClick(() => {
collectVideoData
wixWindow.openLightbox("Purchase Popup", { videoTitle: videoTitle });
});
});
});
async function collectVideoData() {
let videoTitle = $w('#Section2RepeaterItem1Longtext1').text;
let videoDate = $w('#Section2RepeaterItem1Title1').text;
let videoId = $w('#videoPlayer1').id;
let videoDescription = $w('#collapsibleText1').text
}
I’m not sure if I’m actually collecting the video data OR am passing it to the popup. I put the videoTitle into the openLightbox command but that doesn’t seem to work.
The Popup - triggered by pressing #button97 has the following code
import { currentMember } from 'wix-members-frontend';
import * as wixSiteWindow from '@wix/site-window';
import * as wixSiteMembers from '@wix/site-members';
$w.onReady(function () {
autopopulateMemberDetails();
loadVideoData();
});
async function autopopulateMemberDetails() {
const member = await currentMember.getMember();
$w('#VideoPurchaseForm').setFieldValues;
let email_fld0 = 'currentMember.email'
let first_name_c60f = 'currentMember.MemberFirstName';
let last_name_ae59 = 'currentMember.MemberLastName';
}
async function loadVideoData() {
const receivedData = wixSiteWindow.lightbox.getContext()
let long_answer_08a = receivedData;
}
The popup contains a Wix Form that has fields for users to answer that I’m trying to pre-fill (email_fld0, first_name_c60f, last_name_ae59, and long_answer_08a). I’ve tried to keep the code as clean as possible but I know I’m messing something up with the $w, let, const, etc. Once a user has filled in the form properly, then I need to put that data into a shopping cart for purchase (could use any advice on that as well).
Any and all help would be greatly appreciated! Thank you!