Created
May 15, 2013 19:07
-
-
Save Kedrigern/5586460 to your computer and use it in GitHub Desktop.
Volání submitu formuláře z jiného handle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {** | |
| * HomepagePresenter default template | |
| *} | |
| {#content} | |
| <p> | |
| {control formik} | |
| </p> | |
| <p> | |
| <a n:href="form!">Spusť</a> | |
| </p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use \Nette\Application\UI\Form; | |
| class Formik extends Form | |
| { | |
| public function __construct() | |
| { | |
| parent::__construct(); | |
| $this->addSubmit('ok'); | |
| $this->onSuccess[] = $this->submited; | |
| } | |
| public function submited(Form $form) | |
| { | |
| $values = $form->getValues(); | |
| $this->submitedReal(); | |
| } | |
| public function submitedReal() | |
| { | |
| $this->presenter->flashMessage('Ahoj z formu'); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App; | |
| use Nette, | |
| Model; | |
| /** | |
| * Homepage presenter. | |
| */ | |
| class HomepagePresenter extends BasePresenter | |
| { | |
| public function renderDefault() | |
| { | |
| $this->template->anyVariable = 'any value'; | |
| } | |
| public function handleForm() | |
| { | |
| $this['formik']->submitedReal(); | |
| } | |
| protected function createComponentFormik() | |
| { | |
| return new \Formik(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment