Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function createComponentBuyItemForm()
- {
- $presenter = $this;
- return new \Nette\Application\UI\Multiplier(function($itemId) use ($presenter) {
- $form = new Form();
- $form->addText('quantity')
- ->addRule(Form::FILLED, "Počet kusů musí být vyplněn!")
- ->addRule(Form::INTEGER)
- ->setDefaultValue(1);
- $form->addSubmit('save', 'Přidat do košíku');
- $form->onSuccess[] = callback($presenter, 'buyItemFormSubmited');
- return $form;
- });
- }
- public function buyItemFormSubmited($form)
- {
- $id = $form->name;
- $quantity = $form->values->quantity;
- // ...
- }
Advertisement
Add Comment
Please, Sign In to add comment