ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
in_form.php
Go to the documentation of this file.
1<?php
6function in_form()
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 $DIC->ctrl()->setParameterByClass(
20 'ilsystemstyledocumentationgui',
21 'example',
22 'password'
23 );
24 $form_action = $DIC->ctrl()->getFormActionByClass('ilsystemstyledocumentationgui');
25 $form = $ui->input()->container()->form()->standard($form_action, ['password' => $pwd_input]);
26
27 //Step 3: Define some data processing.
28 $result = '';
29 if ($request->getMethod() == "POST"
30 && $request->getQueryParams()['example'] == 'password') {
31 $form = $form->withRequest($request);
32 $result = $form->getData();
33 }
34
35 //Step 4: Render the form/result.
36 return
37 "<pre>" . print_r($result, true) . "</pre><br/>" .
38 $renderer->render($form);
39}
$result
foreach($paths as $path) $request
Definition: asyncclient.php:32
An exception for terminatinating execution or to throw for unit testing.
in_form()
Example of how to process passwords.
Definition: in_form.php:6
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7