ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
in_form.php File Reference

Go to the source code of this file.

Functions

 in_form ()
 Example of how to process passwords. More...
 

Function Documentation

◆ in_form()

in_form ( )

Example of how to process passwords.

Note that the value of Password is a Data\Password, not a string-primitive.

Definition at line 6 of file in_form.php.

7{
8 //Step 0: Declare dependencies
9 global $DIC;
10 $ui = $DIC->ui()->factory();
11 $renderer = $DIC->ui()->renderer();
12 $request = $DIC->http()->request();
13
14 //Step 1: Define the input field.
15 $pwd_input = $ui->input()->field()->password("Password", "Value will be displayed...")
16 ->withRevelation(true);
17
18 //Step 2: Define the form and attach the field.
19 $form = $ui->input()->container()->form()->standard('#', ['password' => $pwd_input]);
20
21 //Step 3: Define some data processing.
22 $result = '';
23 if ($request->getMethod() == "POST") {
24 $form = $form->withRequest($request);
25 $result = $form->getData();
26 }
27
28 //Step 4: Render the form/result.
29 return
30 "<pre>" . print_r($result, true) . "</pre><br/>" .
31 $renderer->render($form);
32}
$result
$DIC
Definition: xapitoken.php:46

References $DIC, and $result.