Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use Nette\Application\UI\Form,
- Nette\Forms\Controls\SubmitButton;
- /**
- * Homepage presenter.
- *
- * @author John Doe
- * @package MyApplication
- */
- class HomepagePresenter extends BasePresenter
- {
- public function renderDefault()
- {
- $this->template->anyVariable = 'any value';
- }
- protected function createComponentTestForm()
- {
- $form = new Form();
- $form->addSelect('item', 'Položka', array(1 => 'Foo', 2 => 'Bar', 3 => 'Baz'));
- $form->addSubmit('send', 'Odeslat')
- ->onClick[] = callback($this, 'addSubitemToForm');
- return $form;
- }
- public function addSubitemToForm(SubmitButton $button)
- {
- $this['testForm']->addSelect('subitem', 'Pod-položky', array(1 => 'Subfoo', 2 => 'Subbar', 3 => 'Subbaz'));
- $this['testForm']->addSubmit('delete', 'Smaž')
- ->onClick[] = callback($this, 'deleteSubitem');
- }
- public function deleteSubitem(SubmitButton $button)
- {
- dump("Jsem zde, už stačí jen smazat co potřebuji a redirectnout.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement