ILIAS  release_7 Revision v7.30-3-g800a261c036
with_required_input.php File Reference

Go to the source code of this file.

Functions

 with_required_input ()
 Example showing a Form with required fields. More...
 

Function Documentation

◆ with_required_input()

with_required_input ( )

Example showing a Form with required fields.

An explaining hint is displayed below the Form.

Definition at line 8 of file with_required_input.php.

References $DIC, and $section.

9 {
10  global $DIC;
11  $ui = $DIC->ui()->factory();
12  $renderer = $DIC->ui()->renderer();
13 
14  $text_input = $ui->input()->field()
15  ->text("Required Input", "User needs to fill this field")
16  ->withRequired(true);
17 
18  $section = $ui->input()->field()->section(
19  [$text_input],
20  "Section with required field",
21  "The Form should show an explaining hint at the bottom"
22  );
23 
24  $form = $ui->input()->container()->form()->standard("", [$section]);
25  return $renderer->render($form);
26 }
$section
Definition: Utf8Test.php:83
global $DIC
Definition: goto.php:24