本文整理汇总了PHP中BaseForm::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseForm::isValid方法的具体用法?PHP BaseForm::isValid怎么用?PHP BaseForm::isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseForm
的用法示例。
在下文中一共展示了BaseForm::isValid方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isValid
/**
* {@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;
}
示例2: processForm
private function processForm($params, BaseForm $form)
{
$form->bind($params);
if ($form->isValid()) {
$form->save();
return true;
}
return false;
}
示例3: isValid
public function isValid()
{
$valid = parent::isValid();
if ($valid) {
return $this->isValidUser();
} else {
return false;
}
}
示例4: processForm
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]));
}
}
示例5: isValid
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;
}
示例6: isValid
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;
}
}
示例7: isValid
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;
}
}
示例8: checkCSRFProtection
public function checkCSRFProtection()
{
$form = new BaseForm();
$form->bind($form->isCSRFProtected() ? array($form->getCSRFFieldName() => $this->getParameter($form->getCSRFFieldName())) : array());
if (!$form->isValid()) {
throw $form->getErrorSchema();
}
}
示例9: executeDeletePair
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();
}
}
示例10: processForm
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');
}
示例11: isValid
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();
}