Hi,
A button in my dynamic page about hotels open a lightbox (“lightbox1”) contact form. I need to pass the title (Hotel Name) to the contact form text box (“#input2”) automatically so the user doesent need to type it again.
I know how to get the title to a form in the same dynamic page from below code. but i need to pass that value to the lightbox form.
const itemObj = $w("#dynamicDataset").getCurrentItem();
$w('#input16').value = itemObj.title; }); //input16 is the textbox in the same page.
Im new to coding. please share an example if anyone can.
Thanks
Thanks alot GOS! Will check now and update here!
Thanks again
This works for me.
https://givemeawhisky.wixsite.com/test/lightboxpass
Page:
import wixWindow from 'wix-window'
import wixData from 'wix-data'
$w.onReady(function () {
})
export function submit_click(event) {
let dataObj = {
"title": $w("#eventName").text,
"price": $w("#amount").text}
wixWindow.openLightbox('Checkout', dataObj);
}
Lightbox:
import wixWindow from 'wix-window';
import wixData from 'wix-data'
$w.onReady( function () {
let dataObj = wixWindow.lightbox.getContext();
$w('#lightBoxTitle').text = dataObj.title,
$w('#amount').text = dataObj.price
})
Thanks GOS. Everything is wokring now!