Pass Checkbox values to tags

Hi there, is it possible to pass the the checkbox value from the light box to tag values in page?
I want to pass the checked values of CHECKBOX GROUP (in lightbox) to the tag values (in page). How can I get the values seperately? Here is my code.

Lightbox code:
import wixWindow from ‘wix-window’ ;
import wixLocation from ‘wix-location’ ;
import { session } from ‘wix-storage’ ;

$w . onReady ( function () {
} );

export function saveButton_click ( event ) {

console . log ( $w ( ‘#checkboxGroup1’ ). selectedIndices );
session . setItem (1, $w ( ‘#checkboxGroup1’ ). value );
wixWindow . lightbox . close ();

Page code:
export function option2_click ( event ) {
wixWindow . openLightbox ( “Field” )
. then ( ( data ) => {
let update = session . getItem ( 1 );
//$w(“#selectionTags1”).options = update;
let TagOptions = $w ( “#selectionTags1” ). options ;
TagOptions . push ({ ‘label’ : ‘A’ , ‘value’ : ‘a’ }); //I want to show checked values seperately by tags here.
$w ( “#selectionTags1” ). options = TagOptions ;

} );


To pass data back to the page that opened the lightbox, you must close the lightbox programmatically using the close() function. Something like this:


(where dataObj is an object with the values to be sent back to the page)

The openLightbox() function returns a Promise which is resolved when the lightbox closes. You can retrieve the data passed from the Lightbox to the page in the Promise. Something like this:

  .then( (data) => {
    let receivedData = data; // data passed back from the Lightbox
  } );

You can see how values are passed to and from the Lightbox in the Slot Machine example.

Thank you for your reply ! I can pass the data from both from lightbox to page and page to lightbox if the data is in input field or text box. Now my data is in checkbox value and I dont know how to pass the checkbox value which is true from lightbox to page. Can you help me with that?

@hninoowuttyeee123 I explained in my previous comment. Something like this:

Send value from Lightbox to the page:

wixWindow.lightbox.close( {
    "checkboxValue": $w('#checkbox').value
} );

Refer to the close() function API.

The Slot Machine example illustrates how to pass values to Lightbox from the page, and from the page to the Lightbox. Open the example in the Editor to inspect the code.