ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
empty_options.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
21 function empty_options()
22 {
23  global $DIC;
24  $ui = $DIC->ui()->factory();
25  $renderer = $DIC->ui()->renderer();
26  $request = $DIC->http()->request();
27 
28  $multi = $ui->input()->field()
29  ->multiselect("No options", []);
30 
31  $form = $ui->input()->container()->form()->standard('#', ['empty' => $multi]);
32 
33  if ($request->getMethod() == "POST") {
34  try {
35  $form = $form->withRequest($request);
36  $result = $form->getData();
37  } catch (\InvalidArgumentException $e) {
38  $result = "No result. Probably, the other form was used.";
39  }
40  } else {
41  $result = "No result yet.";
42  }
43 
44  return
45  "<pre>" . print_r($result, true) . "</pre><br/>" .
46  $renderer->render($form);
47 }
$renderer
global $DIC
Definition: shib_login.php:25
empty_options()
description: > Multi-Select without options