/** * {@inheritDoc} * * Sets render mode to {@link RENDER_SUMMARY}, if validation succeeded. * * @see \Zend\Form\Form::isValid() */ public function isValid() { $isValid = parent::isValid(); if ($isValid) { $this->setRenderMode(self::RENDER_SUMMARY); } return $isValid; }
private function processForm($params, BaseForm $form) { $form->bind($params); if ($form->isValid()) { $form->save(); return true; } return false; }
public function isValid() { $valid = parent::isValid(); if ($valid) { return $this->isValidUser(); } else { return false; } }
protected function processForm(sfWebRequest $request, BaseForm $form) { $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); if ($form->isValid()) { $schedule = $form->save(); $this->getUser()->setFlash('notice', $form->isNew() ? 'The schedule has added' : 'The schedule has updated'); $results = explode('-', $schedule->start_date); $this->redirect(sprintf('@calendar_year_month?year=%d&month=%d', $results[0], $results[1])); } }
public function isValid() { $check = parent::isValid(); $values = $this->getTaintedValues(); //validate email available if ($values['email'] != $this->existingEmail && Doctrine::getTable('SfGuardUser')->emailExists($values['email'])) { $this->addCustomError('This email address is already used by another account.', 'email'); $check = false; } return $check; }
public function isValid() { if (parent::isValid()) { // Clean the students field $students = $this->getValue('students'); $students = str_replace(array("\r\n", "\r"), "\n", $students); $students = trim($students); $this->students = explode("\n", $students); sort($this->students); return true; } else { return false; } }
public function isValid() { $valid = parent::isValid(); if ($valid) { $values = $this->getValues(); $this->user = Doctrine_Core::getTable('sfGuardUser')->createQuery('u')->where('u.email_address = ?', $values['email_address'])->fetchOne(); if ($this->user) { return true; } else { return false; } } else { return false; } }
public function checkCSRFProtection() { $form = new BaseForm(); $form->bind($form->isCSRFProtected() ? array($form->getCSRFFieldName() => $this->getParameter($form->getCSRFFieldName())) : array()); if (!$form->isValid()) { throw $form->getErrorSchema(); } }
public function executeDeletePair(sfWebRequest $request) { $pair = MappingPairTable::getInstance()->find($request->getParameter('id')); if (!$pair) { return $this->notFound(); } /* @var $pair MappingPair */ $form = new BaseForm(); $form->getWidgetSchema()->setNameFormat('delete_pair[%s]'); $form->bind($request->getPostParameter($form->getName())); if ($form->isValid()) { $id = $pair->getId(); $pair->delete(); return $this->ajax()->remove('#pair_' . $id)->remove('#pair_form_' . $id)->render(); } else { return $this->ajax()->form($form)->render(); } }
private function processForm(BaseForm $form, sfWebRequest $request, $type = null) { $name = $form->getName(); $form->bind($request->getParameter($name), $request->getFiles($name)); if ($this->setFlashMessageByType($form->isValid(), $type)) { $form->save(); } $this->redirect('@opCalendarPlugin'); }
public function isValid() { if ($this->member) { return parent::isValid(); } opActivateBehavior::disable(); foreach ($this->getValues() as $key => $value) { if (!empty($this->memberConfigSettings[$key]['IsUnique'])) { $memberConfig = Doctrine::getTable('MemberConfig')->retrieveByNameAndValue($key . '_pre', $value); if ($memberConfig) { $member = $memberConfig->getMember(); if (!$member->getIsActive()) { $this->member = $member; } } } } opActivateBehavior::enable(); return parent::isValid(); }