11 $ui = $DIC->ui()->factory();
12 $lng = $DIC->language();
13 $renderer = $DIC->ui()->renderer();
15 $data = new \ILIAS\Data\Factory();
16 $validation = new \ILIAS\Validation\Factory(
$data,
$lng);
17 $trafo = new \ILIAS\Transformation\Factory();
20 $sum = $trafo->custom(
function ($vs) {
25 $equal_ten = $validation->custom(
function ($v) {
27 },
"The sum must equal ten.");
30 $number_input = $ui->input()->field()->numeric(
"number",
"Put in a number.");
34 $group = $ui->input()->field()->group(
35 [ $number_input->withLabel(
"Left"), $number_input->withLabel(
"Right")]
37 ->withAdditionalTransformation($sum)
38 ->withAdditionalConstraint($equal_ten);
41 $DIC->ctrl()->setParameterByClass(
42 'ilsystemstyledocumentationgui',
46 $form_action = $DIC->ctrl()->getFormActionByClass(
'ilsystemstyledocumentationgui');
47 $form = $ui->input()->container()->form()->standard($form_action, [
"custom_group" => $group]);
51 &&
$request->getQueryParams()[
'example_name'] ==
'numeric_inputs') {
55 $group =
$form->getInputs()[
"custom_group"];
56 if ($group->getError()) {
68 "<pre>" . print_r(
$result,
true) .
"</pre><br/>" .
69 $renderer->render(
$form);
foreach($paths as $path) $request
if(isset($_POST['submit'])) $form