Finally Success! Here’s the code that works in the Archive Videos - Level 2 page and in the Purchase Popup!
import wixWindow from 'wix-window'
import { currentMember } from 'wix-members'
$w.onReady(async () => {
const member = await currentMember.getMember()
$w("#Section2Repeater1").onItemReady(($item, itemData) => {
$item('#button97').onClick(() => {
const videoData = {
videoTitle: itemData.videoTitle,
videoDate: itemData.videoDate,
videoDescription: itemData.videoDescription
};
// Console for debugging
console.log('Video Data =', videoData, 'Member Data = ', member);
wixWindow.openLightbox("Purchase Popup", { videoData, member });
});
});
});
and Purchase Popup.
import { lightbox } from 'wix-window'
const { videoData, member } = lightbox.getContext();
console.log("Lightbox content is:", videoData, member); //Debugging
$w.onReady(function () {
$w('#VideoPurchaseForm').setFieldValues({
email_f1d0: member.loginEmail,
long_answer_08ac: videoData.videoTitle
});
})
I almost fell out of my chair when it worked! Now to figure out how to get the other fields like the currentMember firstName currentMember lastName, addresses, etc., and fill those in. I see the values in the contactDetails, but, unlike the loginEmail, those are buried in the contactDetails section under the contactID.
Thanks for the help!