Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CBooleanValidator
  • CCaptchaValidator
  • CCompareValidator
  • CDateValidator
  • CDefaultValueValidator
  • CEmailValidator
  • CExistValidator
  • CFileValidator
  • CFilterValidator
  • CInlineValidator
  • CNumberValidator
  • CRangeValidator
  • CRegularExpressionValidator
  • CRequiredValidator
  • CSafeValidator
  • CStringValidator
  • CTypeValidator
  • CUniqueValidator
  • CUnsafeValidator
  • CUrlValidator
  • CValidator
  • X2UrlValidator
  • Overview
  • Package
  • Class
  • Tree

Class CInlineValidator

CInlineValidator represents a validator which is defined as a method in the object being validated.

CComponent
Extended by CValidator
Extended by CInlineValidator
Package: system\validators
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/validators/CInlineValidator.php
Methods summary
protected
# validateAttribute( CModel $object, string $attribute )

Validates the attribute of the object. If there is any error, the error message is added to the object.

Validates the attribute of the object. If there is any error, the error message is added to the object.

Parameters

$object
CModel
$object the object being validated
$attribute
string
$attribute the attribute being validated
public string
# clientValidateAttribute( CModel $object, string $attribute )
Returns the JavaScript code needed to perform client-side validation by calling the CInlineValidator::$clientValidate method. In the client validation code, these variables are predefined:
  • value: the current input value associated with this attribute.
  • messages: an array that may be appended with new error messages for the attribute.
  • attribute: a data structure keeping all client-side options for the attribute
Example:
Returns the JavaScript code needed to perform client-side validation by calling the CInlineValidator::$clientValidate method. In the client validation code, these variables are predefined:
  • value: the current input value associated with this attribute.
  • messages: an array that may be appended with new error messages for the attribute.
  • attribute: a data structure keeping all client-side options for the attribute
Example:

If CInlineValidator::$clientValidate is set to "clientValidate123", clientValidate123() is the name of the method that returns the client validation code and can look like:

<?php
  public function clientValidate123($attribute,$params)
  {
     if(!isset($params['message']))
        $params['message']='Value should be 123';
     $js = "if(value != '123') { messages.push($params['message']); }";
     return $js;
  }
?>

Parameters

$object
CModel
$object the data object being validated
$attribute
string
$attribute the name of the attribute to be validated.

Returns

string
the client-side validation script.

Since

1.1.9

See

CActiveForm::$enableClientValidation

Overrides

CValidator::clientValidateAttribute()
Methods inherited from CValidator
addError(), applyTo(), createValidator(), isEmpty(), validate()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public string $method
#

the name of the validation method defined in the active record class

the name of the validation method defined in the active record class

public array $params
#

additional parameters that are passed to the validation method

additional parameters that are passed to the validation method

public string $clientValidate
#

the name of the method that returns the client validation code (See CInlineValidator::clientValidateAttribute()).

the name of the method that returns the client validation code (See CInlineValidator::clientValidateAttribute()).

Properties inherited from CValidator
$attributes, $builtInValidators, $enableClientValidation, $except, $message, $on, $safe, $skipOnError
API documentation generated by ApiGen 2.8.0