CFormInputElement
Package | system.web.form |
---|---|
Inheritance | class CFormInputElement » CFormElement » CComponent |
Since | 1.1 |
Version | $Id: CFormInputElement.php 1896 2010-03-13 14:11:24Z qiang.xue $ |
CFormInputElement can represent the following types of form input based on 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
Because CFormElement is an ancestor class of CFormInputElement, a value assigned to a non-existing property will be stored in attributes which will be passed as HTML attribute values to the CHtml method generating the input or initial values of the widget properties.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
attributes | array | list of attributes (name=>value) for the HTML element represented by this object. | CFormElement |
coreTypes | array | Core input types (alias=>CHtml method name) | CFormInputElement |
errorOptions | array | the options used when rendering the error part. | CFormInputElement |
hint | string | hint text of this input | CFormInputElement |
items | array | the options for this input when it is a list box, drop-down list, check box list, or radio button list. | CFormInputElement |
label | string | the label for this input. | CFormInputElement |
layout | string | the layout used to render label, input, hint and error. | CFormInputElement |
name | string | name of this input | CFormInputElement |
parent | mixed | the direct parent of this element. | CFormElement |
required | boolean | Gets the value indicating whether this input is required. | CFormInputElement |
type | string | the type of this input. | CFormInputElement |
visible | boolean | Returns a value indicating whether this element is visible and should be rendered. | CFormElement |
Public Methods
Method | Description | Defined By |
---|---|---|
__call() | Calls the named method which is not a class method. | CComponent |
__construct() | Constructor. | CFormElement |
__get() | Returns a property value or an attribute value. | CFormElement |
__isset() | Checks if a property value is null. | CComponent |
__set() | Sets value of a property or attribute. | CFormElement |
__toString() | Converts the object to a string. | CFormElement |
__unset() | Sets a component property to be null. | CComponent |
asa() | Returns the named behavior object. | CComponent |
attachBehavior() | Attaches a behavior to this component. | CComponent |
attachBehaviors() | Attaches a list of behaviors to the component. | CComponent |
attachEventHandler() | Attaches an event handler to an event. | CComponent |
canGetProperty() | Determines whether a property can be read. | CComponent |
canSetProperty() | Determines whether a property can be set. | CComponent |
configure() | Configures this object with property initial values. | CFormElement |
detachBehavior() | Detaches a behavior from the component. | CComponent |
detachBehaviors() | Detaches all behaviors from the component. | CComponent |
detachEventHandler() | Detaches an existing event handler. | CComponent |
disableBehavior() | Disables an attached behavior. | CComponent |
disableBehaviors() | Disables all behaviors attached to this component. | CComponent |
enableBehavior() | Enables an attached behavior. | CComponent |
enableBehaviors() | Enables all behaviors attached to this component. | CComponent |
evaluateExpression() | Evaluates a PHP expression or callback under the context of this component. | CComponent |
getEventHandlers() | Returns the list of attached event handlers for an event. | CComponent |
getLabel() | CFormInputElement | |
getParent() | CFormElement | |
getRequired() | Gets the value indicating whether this input is required. | CFormInputElement |
getVisible() | Returns a value indicating whether this element is visible and should be rendered. | CFormElement |
hasEvent() | Determines whether an event is defined. | CComponent |
hasEventHandler() | Checks whether the named event has attached handlers. | CComponent |
hasProperty() | Determines whether a property is defined. | CComponent |
raiseEvent() | Raises an event. | CComponent |
render() | Renders everything for this input. | CFormInputElement |
renderError() | Renders the error display of this input. | CFormInputElement |
renderHint() | Renders the hint text for this input. | CFormInputElement |
renderInput() | Renders the input field. | CFormInputElement |
renderLabel() | Renders the label for this input. | CFormInputElement |
setLabel() | CFormInputElement | |
setRequired() | CFormInputElement | |
setVisible() | CFormElement |
Protected Methods
Method | Description | Defined By |
---|---|---|
evaluateVisible() | Evaluates the visibility of this element. | CFormInputElement |
Property Details
Core input types (alias=>CHtml method name)
the options used when rendering the error part. This property will be passed to the CActiveForm::error method call.
See Also
hint text of this input
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 label for this input. If the label is not manually set, this method will call CModel::getAttributeLabel to determine the label.
the layout used to render label, input, hint and error. They correspond to the placeholders "{label}", "{input}", "{hint}" and "{error}".
name 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.
the type of this input. This can be a widget class name, a path alias of a widget class name, or a input type alias (text, hidden, password, textarea, file, radio, checkbox, listbox, dropdownlist, checkboxlist, or radiolist). If a widget class, it must extend from CInputWidget.
Method Details
protected boolean evaluateVisible()
| ||
{return} | boolean | whether this element is visible. |
Evaluates the visibility of this element. This method will check if the attribute associated with this input is safe for the current model scenario.
public string getLabel()
| ||
{return} | string | the label for this input. If the label is not manually set, this method will call CModel::getAttributeLabel to determine the label. |
public boolean getRequired()
| ||
{return} | boolean | whether this input is required. |
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.
public string render()
| ||
{return} | string | the complete rendering result for this input, including label, input field, hint, and error. |
Renders everything for this input. The default implementation simply returns the result of renderLabel, renderInput, renderHint. When CForm::showErrorSummary is false, renderError is also called to show error messages after individual input fields.
public string renderError()
| ||
{return} | string | the rendering result |
Renders the error display of this input. The default implementation returns the result of CHtml::error
public string renderHint()
| ||
{return} | string | the rendering result. |
Renders the hint text for this input. The default implementation returns the hint property enclosed in a paragraph HTML tag.
public string renderInput()
| ||
{return} | string | the rendering result |
Renders the input field. The default implementation returns the result of the appropriate CHtml method or the widget.
public string renderLabel()
| ||
{return} | string | the rendering result |
Renders the label for this input. The default implementation returns the result of activeLabelEx.
public void setLabel(string $value)
| ||
$value | string | the label for this input |
public void setRequired(boolean $value)
| ||
$value | boolean | whether this input is required. |