Hello, I have seen this question before with repeaters, but not with the actual dynamic pages/multiple buttons. On my site, I have items in a repeater that each have their own dynamic page. On the dynamic page, a user can submit if they are buying/selling that item, and for how much. I am trying to figure out how to connect the dynamic page to the lightbox to remember what item page it is on, as well as how would I set it up for two separate options/buttons/lightboxes?
I am trying to use the tutorial I saw in another forum post: https://support.totallycodable.com/en/article/open-a-lightbox-when-clicking-an-item-in-a-repeater-using-a-button#tutorial-video
but it keeps giving me the error of:
And if I try to submit the data from the lightbox I get this error:
My Current code looks like this:
Items (itemnames) Page:
import wixWindow from ‘wix-window’ ;
export function button5_click(event) {
$w( ‘#button5’ ).onClick(($item, itemData, index) => {
let item = $item( ‘#dynamicDataset’ ).getCurrentItem();
wixWindow.openLightbox( ‘Sellitem’ , item)
});
}
Sellitem Lightbox:
import { lightbox } from ‘wix-window’ ;
import wixData from ‘wix-data’ ;
import wixWindow from ‘wix-window’ ;
$w.onReady(() => {
let theItem = lightbox.getContext(); //this is the item you took from page
let postID = theItem._id; // this is the field key for the item ID in the database collection
$w( “#dataset1” ).setFilter(wixData.filter()
.eq( “_id” , postID) //we are now filtering to to
)
.then(() => {
console.log( “Dataset is now filtered” );
})
. catch ((err) => {
console.log(err);
});
});
Thank you for any help!!