HosipLan

Untitled

Aug 11th, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1.     public function createComponentBuyItemForm()
  2.     {
  3.         $presenter = $this;
  4.             return new \Nette\Application\UI\Multiplier(function($itemId) use ($presenter) {
  5.                     $form = new Form();
  6.  
  7.                     $form->addText('quantity')
  8.                 ->addRule(Form::FILLED, "Počet kusů musí být vyplněn!")
  9.                 ->addRule(Form::INTEGER)
  10.                 ->setDefaultValue(1);
  11.  
  12.             $form->addSubmit('save', 'Přidat do košíku');
  13.             $form->onSuccess[] = callback($presenter, 'buyItemFormSubmited');
  14.  
  15.             return $form;
  16.         });
  17.     }
  18.  
  19.     public function buyItemFormSubmited($form)
  20.     {
  21.         $id = $form->name;
  22.         $quantity = $form->values->quantity;
  23.  
  24.         // ...
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment