ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
with_value.php File Reference

Go to the source code of this file.

Functions

 with_value ()
 Example show how to create and render a basic text input field with an error attached to it. More...
 

Function Documentation

◆ with_value()

with_value ( )

Example show how to create and render a basic text input field with an error attached to it.

This example does not contain any data processing.

Definition at line 6 of file with_value.php.

References $DIC, and $form.

7 {
8  //Step 0: Declare dependencies
9  global $DIC;
10  $ui = $DIC->ui()->factory();
11  $renderer = $DIC->ui()->renderer();
12 
13  //Step 1: Define the text input field and attach some default value
14  $text_input = $ui->input()->field()->text("Basic Input", "Just some basic input
15  with some default value.")
16  ->withValue("Default Value");
17 
18  //Step 2: Define the form and attach the section.
19  $form = $ui->input()->container()->form()->standard("#", [$text_input]);
20 
21  //Step 4: Render the form with the text input field
22  return $renderer->render($form);
23 }
global $DIC
Definition: saml.php:7
if(isset($_POST['submit'])) $form