## Class TCheckBox

Description

Implements interfaces:

- IPostBackDataHandler
- IValidatable

TCheckBox class

TCheckBox displays a check box on the page. You can specify the caption to display beside the check box by setting the Text property. The caption can appear either on the right or left of the check box, which is determined by the TextAlign property.

To determine whether the TCheckBox component is checked, test the Checked property. The OnCheckedChanged event is raised when the Checked state of the TCheckBox component changes between posts to the server. You can provide an event handler for the OnCheckedChanged event to to programmatically control the actions performed when the state of the TCheckBox component changes between posts to the server.

If AutoPostBack is set true, changing the check box state will cause postback action. And if CausesValidation is true, validation will also be processed, which can be further restricted within a ValidationGroup.

Note, Text is rendered as is. Make sure it does not contain unwanted characters that may bring security vulnerabilities.

- since: 3.0
- version: $Revision: $ $Date: $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Web/UI/WebControls/TCheckBox.php (line 43)

    TComponent
       |
       --TApplicationComponent
          |
          --TControl
             |
             --TWebControl
                |
                --TCheckBox

Direct descendents

Class | Description
--- | ---
TRadioButton | TRadioButton class

Method Summary
boolean getAutoPostBack ()
boolean getCausesValidation ()
boolean getChecked ()
TMap getInputAttributes ()
TMap getLabelAttributes ()
array getPostBackOptions ()
string getTagName ()
string getText ()
string getTextAlign ()
string getValidationGroup ()
mixed getValidationPropertyValue ()
string getValueAttribute ()
boolean loadPostData (string $key, array $values)
void onCheckedChanged (TEventParameter $param)
void onPreRender (mixed $param)
void raisePostDataChangedEvent ()
void render (THtmlWriter $writer)
void renderInputTag (THtmlWriter $writer, string $clientID, string $onclick)
void renderLabel (THtmlWriter $writer, string $clientID, string $text)
void setAutoPostBack (boolean $value)
void setCausesValidation (boolean $value)
void setChecked (boolean $value)
void setText (string $value)
void setTextAlign (string $value)
void setValidationGroup (string $value)
Methods
getAutoPostBack (line 172)

- return: whether clicking on the checkbox will post the page.
- access: public

boolean getAutoPostBack ()
getCausesValidation (line 189)

- return: whether postback event triggered by this checkbox will cause input validation, default is true.
- access: public

boolean getCausesValidation ()
getChecked (line 155)

- return: whether the checkbox is checked
- access: public

boolean getChecked ()
getInputAttributes (line 295)

- return: list of attributes to be rendered for the checkbox
- access: public

TMap getInputAttributes ()
getLabelAttributes (line 280)

- return: list of attributes to be rendered for label beside the checkbox
- access: public

TMap getLabelAttributes ()
getPostBackOptions (line 377)

Gets the post back options for this checkbox.

- access: protected

array getPostBackOptions ()
getTagName (line 48)

- return: tag name of the button
- access: protected

string getTagName ()

Redefinition of:

TWebControl::getTagName()
  Returns the tag name used for this control.

getText (line 122)

- return: the text caption of the checkbox
- access: public

string getText ()
getTextAlign (line 139)

- return: the alignment (Left or Right) of the text caption, defaults to Right.
- access: public

string getTextAlign ()
getValidationGroup (line 206)

- return: the group of validators which the checkbox causes validation upon postback
- access: public

string getValidationGroup ()
getValidationPropertyValue (line 114)

Returns the value of the property that needs validation.

- return: the property value to be validated
- access: public

mixed getValidationPropertyValue ()
getValueAttribute (line 310)

- return: the value attribute to be rendered
- access: protected

string getValueAttribute ()

Redefined in descendants as:

- TRadioButton::getValueAttribute()

loadPostData (line 60)

Loads user input data.

This method is primarly used by framework developers.

- return: whether the data of the control has been changed
- access: public

boolean loadPostData (string $key, array $values)

- string $key: the key that can be used to retrieve data from the input data collection
- array $values: the input data collection

Redefined in descendants as:

- TRadioButton::loadPostData() : Loads user input data.

onCheckedChanged (line 90)

Raises OnCheckedChanged event when getChecked changes value during postback.

If you override this method, be sure to call the parent implementation so that the event delegates can be invoked.

- access: public

void onCheckedChanged (TEventParameter $param)

- TEventParameter $param: event parameter to be passed to the event handlers

onPreRender (line 103)

Registers the checkbox to receive postback data during postback.

This is necessary because a checkbox if unchecked, when postback, does not have direct mapping between post data and the checkbox name.

This method overrides the parent implementation and is invoked before render.

- access: public

void onPreRender (mixed $param)

- mixed $param: event parameter

Redefinition of:

TControl::onPreRender()
  This method is invoked when the control enters 'OnPreRender' stage.

raisePostDataChangedEvent (line 77)

Raises postdata changed event.

This method raises OnCheckedChanged event. This method is primarly used by framework developers.

- access: public

void raisePostDataChangedEvent ()
render (line 225)

Renders the checkbox control.

This method overrides the parent implementation by rendering a checkbox input element and a span element if needed.

- access: public

void render (THtmlWriter $writer)

- THtmlWriter $writer: the writer used for the rendering purpose

Redefinition of:

TWebControl::render()
  Renders the control.

renderInputTag (line 343)

Renders a checkbox input element.

- access: protected

void renderInputTag (THtmlWriter $writer, string $clientID, string $onclick)

- THtmlWriter $writer: the writer for the rendering purpose
- string $clientID: checkbox id
- string $onclick: onclick js

Redefined in descendants as:

- TRadioButton::renderInputTag() : Renders a radiobutton input element.

renderLabel (line 327)

Renders a label beside the checkbox.

- access: protected

void renderLabel (THtmlWriter $writer, string $clientID, string $text)

- THtmlWriter $writer: the writer for the rendering purpose
- string $clientID: checkbox id
- string $text: label text

setAutoPostBack (line 181)

Sets a value indicating whether clicking on the checkbox will post the page.

- access: public

void setAutoPostBack (boolean $value)

- boolean $value: whether clicking on the checkbox will post the page.

setCausesValidation (line 198)

Sets the value indicating whether postback event trigger by this checkbox will cause input validation.

- access: public

void setCausesValidation (boolean $value)

- boolean $value: whether postback event trigger by this checkbox will cause input validation.

setChecked (line 164)

Sets a value indicating whether the checkbox is to be checked or not.

- access: public

void setChecked (boolean $value)

- boolean $value: whether the checkbox is to be checked or not.

setText (line 131)

Sets the text caption of the checkbox.

- access: public

void setText (string $value)

- string $value: the text caption to be set

setTextAlign (line 147)

- access: public

void setTextAlign (string $value)

- string $value: the alignment of the text caption. Valid values include Left and Right.

setValidationGroup (line 214)

- access: public

void setValidationGroup (string $value)

- string $value: the group of validators which the checkbox causes validation upon postback

#### Inherited Methods

Inherited From TWebControl

> TWebControl::addAttributesToRender()
> TWebControl::copyBaseAttributes()
> TWebControl::createStyle()
> TWebControl::getAccessKey()
> TWebControl::getBackColor()
> TWebControl::getBorderColor()
> TWebControl::getBorderStyle()
> TWebControl::getBorderWidth()
> TWebControl::getCssClass()
> TWebControl::getFont()
> TWebControl::getForeColor()
> TWebControl::getHasStyle()
> TWebControl::getHeight()
> TWebControl::getStyle()
> TWebControl::getTabIndex()
> TWebControl::getTagName()
> TWebControl::getToolTip()
> TWebControl::getWidth()
> TWebControl::render()
> TWebControl::renderBeginTag()
> TWebControl::renderContents()
> TWebControl::renderEndTag()
> TWebControl::setAccessKey()
> TWebControl::setBackColor()
> TWebControl::setBorderColor()
> TWebControl::setBorderStyle()
> TWebControl::setBorderWidth()
> TWebControl::setCssClass()
> TWebControl::setForeColor()
> TWebControl::setHeight()
> TWebControl::setStyle()
> TWebControl::setTabIndex()
> TWebControl::setToolTip()
> TWebControl::setWidth()

Inherited From TControl

> TControl::__construct()
> TControl::addedControl()
> TControl::addParsedObject()
> TControl::applyStyleSheetSkin()
> TControl::autoBindProperty()
> TControl::autoDataBindProperties()
> TControl::bindProperty()
> TControl::broadcastEvent()
> TControl::broadcastEventInternal()
> TControl::bubbleEvent()
> TControl::clearChildState()
> TControl::clearControlState()
> TControl::clearNamingContainer()
> TControl::clearViewState()
> TControl::createChildControls()
> TControl::createControlCollection()
> TControl::createdOnTemplate()
> TControl::dataBind()
> TControl::dataBindChildren()
> TControl::dataBindProperties()
> TControl::ensureChildControls()
> TControl::findControl()
> TControl::findControlsByID()
> TControl::findControlsByType()
> TControl::focus()
> TControl::getAdapter()
> TControl::getAllowChildControls()
> TControl::getAttribute()
> TControl::getAttributes()
> TControl::getChildControlsCreated()
> TControl::getClientID()
> TControl::getControls()
> TControl::getControlStage()
> TControl::getControlState()
> TControl::getEnabled()
> TControl::getEnableTheming()
> TControl::getEnableViewState()
> TControl::getHasAdapter()
> TControl::getHasAttributes()
> TControl::getHasControls()
> TControl::getID()
> TControl::getNamingContainer()
> TControl::getPage()
> TControl::getParent()
> TControl::getRegisteredObject()
> TControl::getSkinID()
> TControl::getSourceTemplateControl()
> TControl::getTemplateControl()
> TControl::getUniqueID()
> TControl::getViewState()
> TControl::getVisible()
> TControl::hasAttribute()
> TControl::initRecursive()
> TControl::isDescendentOf()
> TControl::isObjectRegistered()
> TControl::loadRecursive()
> TControl::loadState()
> TControl::loadStateRecursive()
> TControl::onDataBinding()
> TControl::onInit()
> TControl::onLoad()
> TControl::onPreRender()
> TControl::onUnload()
> TControl::preRenderRecursive()
> TControl::raiseBubbleEvent()
> TControl::registerObject()
> TControl::removeAttribute()
> TControl::removedControl()
> TControl::render()
> TControl::renderChildren()
> TControl::renderControl()
> TControl::saveState()
> TControl::saveStateRecursive()
> TControl::setAdapter()
> TControl::setAttribute()
> TControl::setChildControlsCreated()
> TControl::setControlStage()
> TControl::setControlState()
> TControl::setEnabled()
> TControl::setEnableTheming()
> TControl::setEnableViewState()
> TControl::setID()
> TControl::setPage()
> TControl::setSkinID()
> TControl::setTemplateControl()
> TControl::setViewState()
> TControl::setVisible()
> TControl::traverseChildControls()
> TControl::unbindProperty()
> TControl::unloadRecursive()
> TControl::unregisterObject()
> TControl::__get()

Inherited From TApplicationComponent

> TApplicationComponent::getApplication()
> TApplicationComponent::getRequest()
> TApplicationComponent::getResponse()
> TApplicationComponent::getService()
> TApplicationComponent::getSession()
> TApplicationComponent::getUser()
> TApplicationComponent::publishAsset()
> TApplicationComponent::publishFilePath()

Inherited From TComponent

> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Class Constants

#### Inherited Constants

Inherited from TControl

Documentation generated on Sun, 04 Jun 2006 18:58:43 -0400 by phpDocumentor 1.3.0RC4