Passing form values to a modal

So, this shouldn’t be so difficult. I have a form, and an on submit event that opens a modal. In the modal I need to access values from the form, however I can’t seem to figure out how to do that.

$category = new Category($db);

$form = $column1->add(‘Form’,[‘segment’]);
$sub_layout = $form->layout->addSubLayout();
$sub_layout->add([‘Header’,‘Print Multiple Labels’,‘size’=>3]);
$sub_layout->addField(‘select_category’, [‘DropDown’, ‘caption’=>‘Select Member Category’])->setModel($category);
$form->buttonSave->set(‘Preview Selection’);

$form->onSubmit(function($form) use ($modalPreview, $categoryField) {

$select_category = $form->model->get('select_category');

if (intval($select_category) > 0) {
    return $modalPreview->show();
} else {
   return (new \atk4\ui\jsNotify('Please select a category.'))->setColor('red')->setPosition('center')->setWidth('50')->setDuration(10000);

$modalPreview = $app->add([‘Modal’, ‘title’ => ‘Review Labels for Print’]);

$modalPreview->set(function ($p) use ($modalPreview, $db, $form, $categoryField) {

/** How do I get the category drop down value, the following is not working **/

$thisCategory = $form->model->get('select_category');

/** End of not working code***/

$p->add('Text')->addParagraph('Category: ' . $thisCategory);

$p->add(['Button','Print Selected Labels'])->on('click', new \atk4\ui\jsExpression('[])',['../labels/generatecontactlabels.php?type=voter&c=' . $thisCategory]));


Alright… I figured it out if anyone got stuck with something similar.

$form->onSubmit(function($form) use ($modalPreview, $categoryField) {
$select_category = $form->model->get(‘select_category’);
$return[] = $modalPreview->show([‘category’=>$form->model[‘select_category’]]);
return $return;

$modalPreview->set(function ($p) use ($modalPreview, $db, $form, $categoryField) {
$thisCategory = $form->model->get(‘select_category’);
$p->add(‘Text’)->addParagraph('Category: ’ . @$_GET[‘category’]);