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

  • CForm
  • CFormButtonElement
  • CFormElement
  • CFormElementCollection
  • CFormInputElement
  • CFormStringElement
  • Overview
  • Package
  • Class
  • Tree

Class CFormInputElement

CFormInputElement represents form input element.

CFormInputElement can represent the following types of form input based on CFormInputElement::$type property:
  • text: a normal text input generated using CHtml::activeTextField()
  • hidden: a hidden input generated using CHtml::activeHiddenField()
  • password: a password input generated using CHtml::activePasswordField()
  • textarea: a text area generated using CHtml::activeTextArea()
  • file: a file input generated using CHtml::activeFileField()
  • radio: a radio button generated using CHtml::activeRadioButton()
  • checkbox: a check box generated using CHtml::activeCheckBox()
  • listbox: a list box generated using CHtml::activeListBox()
  • dropdownlist: a drop-down list generated using CHtml::activeDropDownList()
  • checkboxlist: a list of check boxes generated using CHtml::activeCheckBoxList()
  • radiolist: a list of radio buttons generated using CHtml::activeRadioButtonList()
  • url: an HTML5 url input generated using CHtml::activeUrlField()
  • email: an HTML5 email input generated using CHtml::activeEmailField()
  • number: an HTML5 number input generated using CHtml::activeNumberField()
  • range: an HTML5 range input generated using CHtml::activeRangeField()
  • date: an HTML5 date input generated using CHtml::activeDateField()
  • time: an HTML5 time input generated using CHtml::activeTimeField()
  • datetime: an HTML5 datetime input generated using CHtml::activeDateTimeField()
  • datetimelocal: an HTML5 datetime-local input generated using CHtml::activeDateTimeLocalField()
  • week: an HTML5 week input generated using CHtml::activeWeekField()
  • color: an HTML5 color input generated using CHtml::activeColorField()
  • tel: an HTML5 tel input generated using CHtml::activeTelField()
  • search: an HTML5 search input generated using CHtml::activeSearchField()
The CFormInputElement::$type property can also be a class name or a path alias to the class. In this case, the input is generated using a widget of the specified class. Note, the widget must have a property called "model" which expects a model object, and a property called "attribute" which expects the name of a model attribute.

Because CFormElement is an ancestor class of CFormInputElement, a value assigned to a non-existing property will be stored in CFormElement::$attributes which will be passed as HTML attribute values to the CHtml method generating the input or initial values of the widget properties.

CComponent
Extended by CFormElement
Extended by CFormInputElement
Package: system\web\form
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.1
Located at x2engine/framework/web/form/CFormInputElement.php
Methods summary
public boolean
# getRequired( )

Gets the value indicating whether this input is required. If this property is not set explicitly, it will be determined by calling CModel::isAttributeRequired() for the associated model and attribute of this input.

Gets the value indicating whether this input is required. If this property is not set explicitly, it will be determined by calling CModel::isAttributeRequired() for the associated model and attribute of this input.

Returns

boolean
whether this input is required.
public
# setRequired( boolean $value )

Parameters

$value
boolean
$value whether this input is required.
public string
# getLabel( )

Returns

string
the label for this input. If the label is not manually set, this method will call CModel::getAttributeLabel() to determine the label.
public
# setLabel( string $value )

Parameters

$value
string
$value the label for this input
public string
# render( )

Renders everything for this input. The default implementation simply returns the result of CFormInputElement::renderLabel(), CFormInputElement::renderInput(), CFormInputElement::renderHint(). When CForm::$showErrorSummary is false, CFormInputElement::renderError() is also called to show error messages after individual input fields.

Renders everything for this input. The default implementation simply returns the result of CFormInputElement::renderLabel(), CFormInputElement::renderInput(), CFormInputElement::renderHint(). When CForm::$showErrorSummary is false, CFormInputElement::renderError() is also called to show error messages after individual input fields.

Returns

string
the complete rendering result for this input, including label, input field, hint, and error.
public string
# renderLabel( )

Renders the label for this input. The default implementation returns the result of CHtml activeLabelEx.

Renders the label for this input. The default implementation returns the result of CHtml activeLabelEx.

Returns

string
the rendering result
public string
# renderInput( )

Renders the input field. The default implementation returns the result of the appropriate CHtml method or the widget.

Renders the input field. The default implementation returns the result of the appropriate CHtml method or the widget.

Returns

string
the rendering result
public string
# renderError( )

Renders the error display of this input. The default implementation returns the result of CHtml::error()

Renders the error display of this input. The default implementation returns the result of CHtml::error()

Returns

string
the rendering result
public string
# renderHint( )

Renders the hint text for this input. The default implementation returns the CFormInputElement::$hint property enclosed in a paragraph HTML tag.

Renders the hint text for this input. The default implementation returns the CFormInputElement::$hint property enclosed in a paragraph HTML tag.

Returns

string
the rendering result.
protected boolean
# evaluateVisible( )

Evaluates the visibility of this element. This method will check if the attribute associated with this input is safe for the current model scenario.

Evaluates the visibility of this element. This method will check if the attribute associated with this input is safe for the current model scenario.

Returns

boolean
whether this element is visible.

Overrides

CFormElement::evaluateVisible()
Methods inherited from CFormElement
__construct(), __get(), __isset(), __set(), __toString(), configure(), getParent(), getVisible(), setVisible()
Methods inherited from CComponent
__call(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public static array $coreTypes array( 'text'=>'activeTextField', 'hidden'=>'activeHiddenField', 'password'=>'activePasswordField', 'textarea'=>'activeTextArea', 'file'=>'activeFileField', 'radio'=>'activeRadioButton', 'checkbox'=>'activeCheckBox', 'listbox'=>'activeListBox', 'dropdownlist'=>'activeDropDownList', 'checkboxlist'=>'activeCheckBoxList', 'radiolist'=>'activeRadioButtonList', 'url'=>'activeUrlField', 'email'=>'activeEmailField', 'number'=>'activeNumberField', 'range'=>'activeRangeField', 'date'=>'activeDateField', 'time'=>'activeTimeField', 'datetime'=>'activeDateTimeField', 'datetimelocal'=>'activeDateTimeLocalField', 'week'=>'activeWeekField', 'color'=>'activeColorField', 'tel'=>'activeTelField', 'search'=>'activeSearchField', )
#

Core input types (alias=>CHtml method name)

Core input types (alias=>CHtml method name)

public string $type
#

the type of this input. This can be a widget class name, a path alias of a widget class name, or an input type alias (text, hidden, password, textarea, file, radio, checkbox, listbox, dropdownlist, checkboxlist, or radiolist). If a widget class, it must extend from CInputWidget or (@link CJuiInputWidget).

the type of this input. This can be a widget class name, a path alias of a widget class name, or an input type alias (text, hidden, password, textarea, file, radio, checkbox, listbox, dropdownlist, checkboxlist, or radiolist). If a widget class, it must extend from CInputWidget or (@link CJuiInputWidget).

public string $name
#

name of this input

name of this input

public string $hint
#

hint text of this input

hint text of this input

public array $items array()
#

the options for this input when it is a list box, drop-down list, check box list, or radio button list. Please see CHtml::listData() for details of generating this property value.

the options for this input when it is a list box, drop-down list, check box list, or radio button list. Please see CHtml::listData() for details of generating this property value.

public array $errorOptions array()
#

the options used when rendering the error part. This property will be passed to the CActiveForm::error() method call as its $htmlOptions parameter.

the options used when rendering the error part. This property will be passed to the CActiveForm::error() method call as its $htmlOptions parameter.

Since

1.1.1

See

CActiveForm::error()
public boolean $enableAjaxValidation true
#

whether to allow AJAX-based validation for this input. Note that in order to use AJAX-based validation, CForm::$activeForm must be configured with 'enableAjaxValidation'=>true. This property allows turning on or off AJAX-based validation for individual input fields. Defaults to true.

whether to allow AJAX-based validation for this input. Note that in order to use AJAX-based validation, CForm::$activeForm must be configured with 'enableAjaxValidation'=>true. This property allows turning on or off AJAX-based validation for individual input fields. Defaults to true.

Since

1.1.7
public boolean $enableClientValidation true
#

whether to allow client-side validation for this input. Note that in order to use client-side validation, CForm::$activeForm must be configured with 'enableClientValidation'=>true. This property allows turning on or off client-side validation for individual input fields. Defaults to true.

whether to allow client-side validation for this input. Note that in order to use client-side validation, CForm::$activeForm must be configured with 'enableClientValidation'=>true. This property allows turning on or off client-side validation for individual input fields. Defaults to true.

Since

1.1.7
public string $layout "{label}\n{input}\n{hint}\n{error}"
#

the layout used to render label, input, hint and error. They correspond to the placeholders "{label}", "{input}", "{hint}" and "{error}".

the layout used to render label, input, hint and error. They correspond to the placeholders "{label}", "{input}", "{hint}" and "{error}".

Properties inherited from CFormElement
$attributes
Magic properties summary
public boolean $required
#

Whether this input is required.

Whether this input is required.

public string $label
#

The label for this input. If the label is not manually set, this method will call CModel::getAttributeLabel() to determine the label.

The label for this input. If the label is not manually set, this method will call CModel::getAttributeLabel() to determine the label.

Magic properties inherited from CFormElement
$parent, $visible
API documentation generated by ApiGen 2.8.0