How to get the checkboxes selected info on ModlaDialog form in IssueAction module

Hi,

I’m new to Forge UI development, I’ve a requirement to display the selected checkboxes on the ModalDialog form but they are showing as null. Can you please help me

 return (

// Function to generate acceptance criteria

   const generateTextTest = (selectedCheckboxes) => {
  console.log("selectedCheckboxes =  "+JSON.stringify(selectedCheckboxes));
    let textMsg="";
    for (const checkbox of selectedCheckboxes) {
if (checkbox === 'CB1') {
          textMsg= 'Selected CB1';
        } else if (checkbox =='CB2') {
          textMsg= 'Selected CB2';
        }
}
}


     <ModalDialog header="Generate Text" onClose={() => setOpen(false)} >
        
        <Text>** Issue Description ** : {description} </Text>
        <Form onSubmit={generateTextTest(selectedCheckboxes)}>
            <CheckboxGroup name="selectedEntities" label="Select items to generate Text : " 
                value={selectedCheckboxes}
                onChange={handleCheckboxChange}>
                <Checkbox defaultChecked value="CB1 " label="CB1" />
                <Checkbox value="CB2" label="CB2"/>
                <Checkbox value="CB3" label="CB3"/>
           </CheckboxGroup> 
        </Form>
        { generatedTxt && (
          <Fragment>
            <SectionMessage title="Generated Text " appearance="info">
             <Text format="text">{generatedTxt}</Text>
           </SectionMessage>
         </Fragment>
        )}
      </ModalDialog>
    );
  };