/** * Validate the form */ private function validateForm() { if ($this->frm->isSubmitted()) { // cleanup the submitted fields, ignore fields that were added by hackers $this->frm->cleanupFields(); // validate fields $this->frm->getField('name')->isFilled(BL::err('AuthorIsRequired')); $this->frm->getField('email')->isEmail(BL::err('EmailIsInvalid')); // no errors? if ($this->frm->isCorrect()) { // build item $item['id'] = $this->id; $item['status'] = $this->record['status']; $item['name'] = $this->frm->getField('name')->getValue(); $item['email'] = $this->frm->getField('email')->getValue(); // insert the item BackendAgendaModel::updateSubscription($item); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_edit_subscription', array('item' => $item)); // everything is saved, so redirect to the overview $this->redirect(BackendModel::createURLForAction('subscriptions') . '&report=edited-subscription&id=' . $item['id'] . '&highlight=row-' . $item['id'] . '#tab' . \SpoonFilter::toCamelCase($item['status'])); } } }