Question:
Is there a way to pass data from a dynamic page/repeater to a lightbox if your website is password protected?
Product:
Wix Editor, Velo
What are you trying to achieve:
I have a dynamic page that’s loading/displaying data from a collection (#gifts). In each repeater container, I have a title (#repeaterTitle), a description, an image and a button (#repeaterButton). Once you click the button, a lightbox (GiftForm) opens where a title (#lightboxTitle), some input fields and a submit button are shown.
The title in the lightbox should be the same as in the repeater where the button was clicked. I was able to achieve this with the following code:
Dynamic page:
import { openLightbox } from 'wix-window-frontend';
export function repeaterButton_click(event, $w) {
openLightbox("GiftForm", $w('#repeaterTitle').text);
}
Lightbox (GiftForm):
import { lightbox } from 'wix-window-frontend';
$w.onReady( function() {
let lightboxTitle = lightbox.getContext();
$w('#lightboxTitle').text = lightboxTitle;
});
The code is running fine in preview mode and if my page is not password protected. Once I password protect the whole page, I get the following error message:
wixSelector.ts:304 TypeError: $w(...).onReady is not a function
at eval (gxouw.js:8:23)
at t (wixSelector.ts:302:19)
at wixSelector.ts:317:27
at wixSelector.ts:119:48
at Array.map (<anonymous>)
at m (wixSelector.ts:119:31)
at Array.map (<anonymous>)
at Object.flushOnReadyCallbacks (wixSelector.ts:124:65)
at applications.ts:374:21
at async Object.runAsyncAndReport (platformLogger.ts:218:10)
What have you already tried:
- Removing the page password
- Fiddled around with the collection settings/authorizations
Additional information:
I might be overcomplicating it, is there another/easier way to pass data from a repeater to a lightbox so they share the same content?
The page is for my wedding, so password protection is a must for privacy reasons.
Thanks for your help!