当前位置: 首页>>代码示例>>PHP>>正文


PHP CFormModel::validate方法代码示例

本文整理汇总了PHP中CFormModel::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP CFormModel::validate方法的具体用法?PHP CFormModel::validate怎么用?PHP CFormModel::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFormModel的用法示例。


在下文中一共展示了CFormModel::validate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate

 public function validate($attributes = null, $clearErrors = true)
 {
     $valid = parent::validate($attributes, $clearErrors);
     if (!$valid && $this->throwExceptions) {
         throw new $exceptionClass(400, CJSON::encode($this->getErrors()));
     }
     return $valid;
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:8,代码来源:X2FormModel.php

示例2: validate

 public function validate()
 {
     if (!$this->result->getStatus()) {
         $this->addErrors(array('social_response_error' => $this->result->getResult()));
         return false;
     }
     return parent::validate();
 }
开发者ID:JimmDiGriz,项目名称:HGApi,代码行数:8,代码来源:SocialServiceForm.php

示例3: validate

 public function validate()
 {
     $year = Yii::app()->dateFormatter->format("yyyy", $ths->date);
     if (!($year >= 1900 && $year <= 2050)) {
         $this->addError('date', 'Данный год не поддерживается системой');
     }
     return parent::validate();
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:8,代码来源:RegistrationForm.php

示例4: validate

 public function validate($attributes = NULL, $clearErrors = true)
 {
     $valid = parent::validate();
     if ($this->hasErrors()) {
         return false;
     }
     return true;
 }
开发者ID:Diakonrus,项目名称:fastweb-yii,代码行数:8,代码来源:RecoveryForm.php

示例5: validatewithId

 public function validatewithId($form, $attributes = null, $clearErrors = true)
 {
     parent::validate($attributes, $clearErrors);
     foreach ($form->questions_group as $group) {
         if ($group->id == $this->id) {
             $this->addError('id', Yii::t('common', 'loginExist'));
         }
     }
     return !$this->hasErrors();
 }
开发者ID:Biobanques,项目名称:cbsd_platform,代码行数:10,代码来源:QuestionBlocForm.php

示例6: create

 public function create()
 {
     if (false !== parent::validate()) {
         $this->name = trim($this->name);
         if (null === Yii::app()->authManager->getAuthItem($this->name)) {
             Yii::app()->authManager->createAccessLevel($this->name, $this->description);
             return true;
         } else {
             $this->addError('name', 'Group "' . $this->name . '" already exists');
             return false;
         }
     }
     return false;
 }
开发者ID:apa-narola,项目名称:yiimoduledemo,代码行数:14,代码来源:GroupForm.php

示例7: validate

 /**
  * @param array $attributes
  * @param bool  $clearErrors
  *
  * @throws DreamFactory\Platform\Exceptions\ForbiddenException
  * @return bool
  */
 public function validate($attributes = null, $clearErrors = true)
 {
     if ($this->_skipped) {
         $this->_emailAddress = null;
         return true;
     }
     /** @var User $_user */
     if (null === ($_user = User::model()->findByPk(Session::getCurrentUserId()))) {
         throw new ForbiddenException();
     }
     if (empty($this->_emailAddress)) {
         $this->_emailAddress = $_user->email;
     }
     return parent::validate($attributes, $clearErrors);
 }
开发者ID:digideskio,项目名称:dsp-core,代码行数:22,代码来源:SupportForm.php

示例8: validate

 public function validate($attributes = NULL, $clearErrors = true)
 {
     $valid = parent::validate();
     if (empty($this->email)) {
         $this->addError('email', 'Email не может быть пустым.');
         return false;
     }
     if (!User::model()->find('email LIKE "' . $this->email . '"')) {
         $this->addError('email', 'Пользователь с таким email не найден.');
         return false;
     }
     if ($this->hasErrors()) {
         return false;
     }
     return true;
 }
开发者ID:Diakonrus,项目名称:fastweb-yii,代码行数:16,代码来源:RecoveryForm.php

示例9: validate

 /**
  * Validates a ProfileFieldType
  *
  * This is only necessary when its linked to a profileField and the profiletype
  * has the current type of profilefieldtype
  *
  * @return boolean
  */
 public function validate($attributes = null, $clearErrors = true)
 {
     // Bound to a profile field?
     if ($this->profileField != null) {
         // Current Profile Field matches the selected profile field
         if ($this->profileField->field_type_class == get_class($this)) {
             return parent::validate($attributes, $clearErrors);
         }
     }
     return true;
 }
开发者ID:alefernie,项目名称:intranet,代码行数:19,代码来源:ProfileFieldType.php


注:本文中的CFormModel::validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。