Class TCheckBox

Description

Implements interfaces:

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: $Id: TCheckBox.php 2522 2008-10-13 21:40:53Z mikl $
  • 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
TActiveCheckBox TActiveCheckBox class.
TRadioButton TRadioButton class
Method Summary
boolean getAutoPostBack ()
boolean getCausesValidation ()
boolean getChecked ()
string getClientClassName ()
boolean getData ()
boolean getDataChanged ()
bool getIsValid ()
bool getSpanNeeded ()
string getTagName ()
string getText ()
string getValidationGroup ()
string getValue ()
string getValueAttribute ()
boolean loadPostData (string $key, array $values)
void onPreRender (mixed $param)
void render (THtmlWriter $writer)
void renderClientControlScript (mixed $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 setData (boolean $value)
void setEnableClientScript (boolean $value)
void setIsValid (bool $value)
void setText (string $value)
void setTextAlign (TTextAlign $value)
void setValidationGroup (string $value)
void setValue (string $value)
Methods
getAutoPostBack (line 241)
  • return: whether clicking on the checkbox will post the page.
  • access: public
boolean getAutoPostBack ()
getCausesValidation (line 258)
  • return: whether postback event triggered by this checkbox will cause input validation, default is true.
  • access: public
boolean getCausesValidation ()
getChecked (line 198)
  • return: whether the checkbox is checked
  • access: public
boolean getChecked ()
getClientClassName (line 494)

Gets the name of the javascript class responsible for performing postback for this control.

This method overrides the parent implementation.

  • return: the javascript class name
  • access: protected
string getClientClassName ()

Redefined in descendants as:
getData (line 220)

Returns the value indicating whether the checkbox is checked.

This method is required by IDataRenderer. It is the same as getChecked().

boolean getData ()
getDataChanged (line 115)

Returns a value indicating whether postback has caused the control data change.

This method is required by the IPostBackDataHandler interface.

  • return: whether postback has caused the control data change. False if the page is not in postback mode.
  • access: public
boolean getDataChanged ()
getEnableClientScript (line 400)
  • return: whether to render javascript.
  • access: public
boolean getEnableClientScript ()

Redefined in descendants as:
getInputAttributes (line 366)
  • return: list of attributes to be rendered for the checkbox
  • access: public
TMap getInputAttributes ()
getIsValid (line 134)

Returns true if this control validated successfully.

Defaults to true.

  • return: wether this control validated successfully.
  • access: public
bool getIsValid ()
getLabelAttributes (line 351)
  • return: list of attributes to be rendered for label beside the checkbox
  • access: public
TMap getLabelAttributes ()

Redefined in descendants as:
getPostBackOptions (line 503)

Gets the post back options for this checkbox.

  • access: protected
array getPostBackOptions ()
getSpanNeeded (line 419)

Check if we need a span tag to surround this control. The span tag will be created if the Text property is set for this control.

  • return: wether this control needs a surrounding span tag
  • access: protected
bool getSpanNeeded ()
getSurroundingTagID (line 291)
  • return: the id of the surrounding tag or this clientID if no such tag needed
  • access: public
string getSurroundingTagID ()
getTagName (line 51)
  • return: tag name of the button
  • access: protected
string getTagName ()

Redefinition of:
TWebControl::getTagName()
Returns the tag name used for this control.
getText (line 149)
  • return: the text caption of the checkbox
  • access: public
string getText ()
getTextAlign (line 182)
  • return: the alignment (Left or Right) of the text caption, defaults to TTextAlign::Right.
  • access: public
TTextAlign getTextAlign ()
getValidationGroup (line 275)
  • return: the group of validators which the checkbox causes validation upon postback
  • access: public
string getValidationGroup ()
getValidationPropertyValue (line 124)

Returns the value of the property that needs validation.

  • return: the property value to be validated
  • access: public
mixed getValidationPropertyValue ()
getValue (line 166)
  • return: the value of the checkbox. Defaults to empty.
  • access: public
string getValue ()
getValueAttribute (line 381)
  • return: the value attribute to be rendered
  • access: protected
string getValueAttribute ()

Redefined in descendants as:
loadPostData (line 63)

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:
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 302)

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.
renderClientControlScript (line 483)

Renders the client-script code.

  • access: protected
void renderClientControlScript (mixed $writer)

Redefined in descendants as:
renderInputTag (line 445)

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:
renderLabel (line 429)

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

Redefined in descendants as:
setAutoPostBack (line 250)

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 267)

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 207)

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.

Redefined in descendants as:
setData (line 233)

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

This method is required by IDataRenderer. It is the same as setChecked().

void setData (boolean $value)
  • boolean $value: whether the checkbox is to be checked
setEnableClientScript (line 408)
  • access: public
void setEnableClientScript (boolean $value)
  • boolean $value: whether to render javascript.

Redefined in descendants as:
setIsValid (line 141)
  • access: public
void setIsValid (bool $value)
  • bool $value: wether this control is valid.
setText (line 158)

Sets the text caption of the checkbox.

  • access: public
void setText (string $value)
  • string $value: the text caption to be set

Redefined in descendants as:
setTextAlign (line 190)
  • access: public
void setTextAlign (TTextAlign $value)
  • TTextAlign $value: the alignment of the text caption. Valid values include Left and Right.
setValidationGroup (line 283)
  • access: public
void setValidationGroup (string $value)
  • string $value: the group of validators which the checkbox causes validation upon postback
setValue (line 174)
  • access: public
void setValue (string $value)
  • string $value: the value of the checkbox

Inherited Methods

Inherited From TWebControl

TWebControl::addAttributesToRender()
TWebControl::clearStyle()
TWebControl::copyBaseAttributes()
TWebControl::createStyle()
TWebControl::getAccessKey()
TWebControl::getBackColor()
TWebControl::getBorderColor()
TWebControl::getBorderStyle()
TWebControl::getBorderWidth()
TWebControl::getCssClass()
TWebControl::getDisplay()
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::setDisplay()
TWebControl::setForeColor()
TWebControl::setHeight()
TWebControl::setStyle()
TWebControl::setTabIndex()
TWebControl::setToolTip()
TWebControl::setWidth()

Inherited From TControl

TControl::__construct()
TControl::addedControl()
TControl::addParsedObject()
TControl::addToPostDataLoader()
TControl::applyStyleSheetSkin()
TControl::autoBindProperty()
TControl::autoDataBindProperties()
TControl::bindProperty()
TControl::broadcastEvent()
TControl::bubbleEvent()
TControl::clearChildState()
TControl::clearControlState()
TControl::clearNamingContainer()
TControl::clearViewState()
TControl::convertUniqueIdToClientId()
TControl::createChildControls()
TControl::createControlCollection()
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::getCustomData()
TControl::getEnabled()
TControl::getEnableTheming()
TControl::getEnableViewState()
TControl::getHasAdapter()
TControl::getHasAttributes()
TControl::getHasChildInitialized()
TControl::getHasControls()
TControl::getHasInitialized()
TControl::getHasLoaded()
TControl::getHasLoadedPostData()
TControl::getHasPreRendered()
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::setCustomData()
TControl::setEnabled()
TControl::setEnableTheming()
TControl::setEnableViewState()
TControl::setID()
TControl::setPage()
TControl::setSkinID()
TControl::setTemplateControl()
TControl::setViewState()
TControl::setVisible()
TControl::trackViewState()
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::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
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

Documentation generated on Sun, 11 Jan 2009 20:19:53 -0500 by phpDocumentor 1.3.0RC4