當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。