Steps example.
Steps exampleThis demonstrates dividing the form into separate pages using step container elements. As usual the form itself can only be valid when all its input elements are valid. It is also possible to attach input elements directly to the form (outside any step container). These elements are visible on every step.
<?php
require_once '../../HtmlForm.php';
'backLabel' => "back",
]);
$form->addStepNav();
$firstStep = $form->addStep('firstStep', ['label' => "1. First step"]);
$firstStep->addText('text1', ['label' => 'First step text field', 'required' => true]);
$secondStep = $form->addStep('secondStep', ['label' => "2. Second step"]);
$secondStep->addText('text2', ['label' => 'Second step text field', 'required' => true]);
$thirdStep = $form->addStep('thirdStep', ['label' => "3. Third step"]);
$thirdStep->addText('text3', ['label' => 'Third step text field', 'required' => true]);
$form->process();
if ($form->validate()) {
echo('<a href="steps.php">back</a>');
echo('<pre>');
var_dump($form->getValues());
echo('</pre>');
$form->clearSession();
} else {
?>
<!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="../../lib/css/depage-forms.css">
</head>
<body>
<?php echo($form); ?>
</body>
<?php
}