Advertisement
Whistik

Untitled

May 8th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <?php
  2. use Nette\Application\UI;
  3.  
  4. class HomepagePresenter extends UI\Presenter
  5. {
  6.  
  7.     // ...
  8.  
  9.     protected function createComponentRegistrationForm()
  10.     {
  11.         $form = new UI\Form;
  12.         $form->addText('name', 'Jméno:');
  13.         $form->addPassword('password', 'Heslo:');
  14.         $form->addSubmit('login', 'Registrovat');
  15.         $form->onSuccess[] = [$this, 'registrationFormSucceeded'];
  16.         return $form;
  17.     }
  18.  
  19.     // volá se po úspěšném odeslání formuláře
  20.     public function registrationFormSucceeded(UI\Form $form, $values)
  21.     {
  22.         // ...
  23.         $this->flashMessage('Byl jste úspěšně registrován.');
  24.         $this->redirect('Homepage:');
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement