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 GOS. Everything is wokring now!
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 alot GOS! Will check now and update here!
Thanks again
Have you read the Wix API reference for this?
https://www.wix.com/corvid/reference/wix-window.lightbox.html#getContext
This has also been talked about in previous forum posts if you search....
https://www.wix.com/corvid/forum/community-discussion/dynamic-lightbox-from-repeater
https://www.wix.com/corvid/forum/community-discussion/dynamic-lightbox-getcontext-please-help-i-am-stuck
https://www.wix.com/corvid/forum/community-discussion/dynamic-page-lightboxes
These outside pages might help you too.
https://support.totallycodable.com/en/article/open-a-lightbox-when-clicking-an-item-in-a-repeater-using-a-button
https://www.vorbly.com/Vorbly-Code/WIX-CODE-LINK-TWO-DYNAMIC-PAGES
https://www.vorbly.com/Vorbly-Code/WIX-CODE-SENDING-DATA-TO-LIGHTBOX