PluginProbe
Packeta / 2.1
Packeta v2.1
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / deps / nette / forms / examples / containers.php

containers.php in Packeta 2.1, at deps/nette/forms/examples/containers.php

53 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Nette Forms containers example.
5 */
6 declare (strict_types=1);
7 namespace Packetery;
8
9 if (@(!(include __DIR__ . '/../vendor/autoload.php'))) {
10 die('Install packages using `composer install`');
11 }
12 use Packetery\Nette\Forms\Form;
13 use Packetery\Tracy\Debugger;
14 use Packetery\Tracy\Dumper;
15 Debugger::enable();
16 $form = new Form();
17 // group First person
18 $form->addGroup('First person');
19 $first = $form->addContainer('first');
20 $first->addText('name', 'Your name:');
21 $first->addText('email', 'Email:');
22 $first->addText('street', 'Street:');
23 $first->addText('city', 'City:');
24 // group Second person
25 $form->addGroup('Second person');
26 $second = $form->addContainer('second');
27 $second->addText('name', 'Your name:');
28 $second->addText('email', 'Email:');
29 $second->addText('street', 'Street:');
30 $second->addText('city', 'City:');
31 // group for button
32 $form->addGroup();
33 $form->addSubmit('submit', 'Send');
34 if ($form->isSuccess()) {
35 echo '<h2>Form was submitted and successfully validated</h2>';
36 Dumper::dump($form->getValues());
37 exit;
38 }
39 ?>
40 <!DOCTYPE html>
41 <meta charset="utf-8">
42 <title>Nette Forms containers example</title>
43 <link rel="stylesheet" media="screen" href="assets/style.css" />
44
45 <h1>Nette Forms containers example</h1>
46
47 <?php
48 $form->render();
49 ?>
50
51 <footer><a href="https://doc.nette.org/en/forms">see documentation</a></footer>
52 <?php
53