top of page
  • Writer's pictureArun Kumar

Pass Data to LightBox

We can pass data to a LightBox from any page of our wix website. In the below example we are invoking LightBox from velo code by passing contact ID and contact name

//open lignbox & pass the current contact ID to delete it

export function deleteBtn_click(event) {
    
    //get current contact ID into a variable
    let contactId = $w('#dynamicDataset').getCurrentItem();

    //pass the contact id and first name to lightbox
    wixWindow.openLightbox('Remove Contact', {
        "contactId": contactId._id,
        "contactName": contactId.title
    });

}

Inside the LightBox, you must catch the received data inside onReady() event. Below, we are capturing the received data inside received variable and using the same info the display in the text box

$w.onReady(function () {

    //to capture received name and id
    let received = wixWindow.lightbox.getContext();
    
    $w('#confirmTxt').text = `Delete ${received.contactName}?`;

});

Cheers 😇😇😇

14 views0 comments
bottom of page