9 $ui = $DIC->ui()->factory();
10 $renderer = $DIC->ui()->renderer();
14 $dependant_field = $ui->input()->field()->text(
"Item 1",
"Just some dependent group field");
15 $dependant_group = $ui->input()->field()->dependantGroup([
"dependant_field" => $dependant_field]);
18 $checkbox_input = $ui->input()->field()->checkbox(
"Checkbox",
"Check to display dependant field.")
19 ->withDependantGroup($dependant_group);
22 $DIC->ctrl()->setParameterByClass(
23 'ilsystemstyledocumentationgui',
27 $form_action = $DIC->ctrl()->getFormActionByClass(
'ilsystemstyledocumentationgui');
28 $form = $ui->input()->container()->form()->standard($form_action, [ $checkbox_input]);
33 &&
$request->getQueryParams()[
'example_name'] ==
'dependant_checkbox') {
42 "<pre>" . print_r(
$result,
true) .
"</pre><br/>" .
43 $renderer->render(
$form);
with_dependant_group()
Example showing how a dependant group (aka sub form) might be attached to a checkbox.
foreach($paths as $path) $request
if(isset($_POST['submit'])) $form