Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- use Nette\Forms\Form;
- use Tracy\Debugger;
- use Tracy\Dumper;
- use Nette\Utils\Html;
- //Debugger::enable();
- //
- //
- //
- print_r($_POST);
- $form = new Form;
- $form->action='?1';
- $form->getElementPrototype()->novalidate = "novalidate";
- $cont = $form->addContainer('first');
- $cont->addText('name', 'Your name:')
- ->setRequired('Enter your name');
- $cont->addHidden('a', '1')->setValue(1);
- $cont->addSubmit('submit', 'Send');
- $form2 = new Form;
- $form2->action='?2';
- $form2->getElementPrototype()->novalidate = "novalidate";
- $cont = $form2->addContainer('second');
- $cont->addText('name', 'Your name:')
- ->setRequired('Enter your name');
- $cont->addHidden('b', '1')->setValue(1);
- $cont->addSubmit('submit', 'Send');
- if ($form->isSubmitted() && $form->isSuccess()) {
- echo '<h2>Form was submitted and successfully validated</h2>';
- Dumper::dump($form->getValues(), [Dumper::COLLAPSE => FALSE]);
- }
- if ($form2->isSubmitted() && $form2->isSuccess()) {
- echo '<h2>Form2 was submitted and successfully validated</h2>';
- Dumper::dump($form2->getValues(), [Dumper::COLLAPSE => FALSE]);
- }
- ?>
- <!DOCTYPE html>
- <meta charset="utf-8">
- <title>Nette Forms basic example</title>
- <link rel="stylesheet" media="screen" href="assets/style.css" />
- <script src="https://nette.github.io/resources/js/netteForms.js"></script>
- <h1>Nette Forms basic example</h1>
- <?php echo $form ?>
- <hr />
- <?php echo $form2 ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement