Sending Data to a Form inside a Lightbox

Thank you, azevedo.bang, your example helped me a lot! There’s a small typo in your lightbox code: When setting the text for ‘#hello’ you refer to your const Data with quotes around it which results in the word “Data” being set instead of the value from the Data variable.

Here’s my working code to click a button on a page which then launches a lightbox, passes a value to it, and displays that value in a text field:

Code on the page:

import {session} from 'wix-storage';
import wixWindow from 'wix-window';

export function deleteClassmateButton_click(event) {
    session.setItem('PassDeleteClassmate', $w('#editNameInSchool').value);
    wixWindow.openLightbox("Delete Classmate Confirm");
}
  1. The button deleteClassmateButton’s onClick calls function deleteClassmateButton_click

  2. The value from text field editNameInSchool is stored into session variable PassDeleteClassmate

  3. The lightbox Delete Classmate Confirm is launched

Code on the lightbox:

import {session} from 'wix-storage';

$w.onReady(function () {
 const Name = session.getItem('PassDeleteClassmate');
    $w('#classmateName').text = Name;
});
  1. Constant variable Name is set to the data in session variable PassDeleteClassmate

  2. The value for text field classmateName is set to data in Name variable

Thanks again, happy coding!