public function onSuccess(\Nette\Application\UI\Form $form) { try { $vars = $form->getValues(); $this->items->competition = $vars; $this->items->save(); $this->cleanCache('', array('competitions', 'competition')); $this->flashMessage('Competition has been saved successfully!', 'ok'); $this->redirect('default'); } catch (Exception $e) { $this->flashMessage('Ooops! Something bad happend! ' . $e->getMessage(), 'err'); } }