Permalink
Browse files

Final registration form

  • Loading branch information...
vojtasvoboda committed Aug 17, 2014
1 parent fb8f546 commit 98399ca5b775ee3cbab00583e9052b8275cdd084
Showing with 55 additions and 9 deletions.
  1. +50 −0 forms/RegistrationForm.php
  2. +5 −9 index.php
View
@@ -0,0 +1,50 @@
<?php
use Nette\Forms\Form;
use Nette\Utils\Html;
/**
* Class RegistrationForm
*/
class RegistrationForm extends Form {
public function __construct($name = NULL) {
parent::__construct($name);
// select box for choosing date
$this->addSelect('date', 'Den:',
array(
'2014-07-04' => '4.7.',
'2014-07-05' => '5.7.',
'2014-07-06' => '6.7.',
'2014-07-07' => '7.7.',
'2014-07-08' => '8.7.',
)
)->setRequired('Vyberte prosím datum');
// select box for choosing time
$this->addSelect('time', 'Čas:',
array(
'09:00:00' => '9:00',
'12:00:00' => '12:00',
'15:00:00' => '15:00',
)
)->setRequired('Vyberte prosím datum');
// inputs for name and e-mail
$this->addText('name', 'Jméno:')->setRequired('Zadejte prosím jméno');
$this->addText('email', 'E-mail:')->setRequired('Zadejte prosím e-mail');
// checkbox for contest terms
$checkboxLabel = Html::el();
$checkboxLabel->add('Souhlasím s ');
$checkboxLabel->add(Html::el('a')->href('/podminky/')->target('_blank')->setText('podmínkami'));
$this->addCheckbox('terms', $checkboxLabel)->setRequired('Musíte souhlasit s podmínkami.');
// submit button
$this->addSubmit('send', 'Odeslat rezervaci');
}
}
View
@@ -1,6 +1,7 @@
<?php
require 'vendor/autoload.php';
require 'vendor/autoload.php';
require 'forms/RegistrationForm.php';
?>
<!doctype html>
@@ -17,21 +18,16 @@
<script src="vendor/nette/forms/src/assets/netteForms.js"></script>
<style>
.required label { color: maroon }
th { text-align: right; }
</style>
</head>
<body>
<?php
use Nette\Forms\Form;
$form = new Form;
$form->addText('name', 'Name:');
$form->addPassword('password', 'Password:');
$form->addSubmit('send', 'Register');
// create registration form
$form = new RegistrationForm();
// renders the form
echo $form;

0 comments on commit 98399ca

Please sign in to comment.