/** * Validate the form */ protected function validateForm() { // is the form submitted? if ($this->frm->isSubmitted()) { // cleanup the submitted fields, ignore fields that were added by hackers $this->frm->cleanupFields(); // validate fields $this->frm->getField('title')->isFilled(BL::err('NameIsRequired')); $this->frm->getField('video')->isFilled(BL::err('FieldIsRequired')); // no errors? if ($this->frm->isCorrect()) { // build image record to insert $item['id'] = $this->id; $item['title'] = $this->frm->getField('title')->getValue(); $item['filename'] = $this->frm->getField('video')->getValue(); // save the item $id = BackendAgendaModel::saveVideo($item); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_edit_video', array('item' => $item)); // everything is saved, so redirect to the overview $this->redirect(BackendModel::createURLForAction('media') . '&agenda_id=' . $this->itemId . '&report=edited&var=' . urlencode($item['title']) . '&highlight=row-' . $item['id'] . '#tabVideos'); } } }