Go to the source code of this file.
|
| with_required_sub_inputs () |
| Example showing how an optional group (of inputs) which shows, that the optional input will not be required even though it's sub inputs are. More...
|
|
◆ with_required_sub_inputs()
with_required_sub_inputs |
( |
| ) |
|
Example showing how an optional group (of inputs) which shows, that the optional input will not be required even though it's sub inputs are.
Definition at line 8 of file with_required_sub_inputs.php.
9{
12 $renderer =
$DIC->ui()->renderer();
13 $request =
$DIC->http()->request();
14
15 $optional_group =
$factory->input()->field()->optionalGroup([
17 'this input is required',
18 'but only if the optional group is checked'
19 )->withRequired(true)
20 ], 'this input is not required');
21
22 $form =
$factory->input()->container()->form()->standard(
'#', [$optional_group]);
23
24 if ("POST" === $request->getMethod()) {
25 $form = $form->withRequest($request);
27 } else {
29 }
30
31 return "<pre>" . print_r(
$result,
true) .
"</pre>" . $renderer->render($form);
32}
References $DIC, $factory, and $result.