Skip to content

Instantly share code, notes, and snippets.

@Kedrigern
Created May 15, 2013 19:07
Show Gist options
  • Select an option

  • Save Kedrigern/5586460 to your computer and use it in GitHub Desktop.

Select an option

Save Kedrigern/5586460 to your computer and use it in GitHub Desktop.
Volání submitu formuláře z jiného handle
{**
* HomepagePresenter default template
*}
{#content}
<p>
{control formik}
</p>
<p>
<a n:href="form!">Spusť</a>
</p>
<?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');
}
}
<?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