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 1453 2006-10-01 03:09:18Z wei $
  • 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 ()
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 setEnableClientScript (boolean $value)
void setText (string $value)
void setTextAlign (TTextAlign $value)
void setValidationGroup (string $value)
void setValue (string $value)
Methods
getAutoPostBack (line 185)
  • return: whether clicking on the checkbox will post the page.
  • access: public
boolean getAutoPostBack ()
getCausesValidation (line 202)
  • return: whether postback event triggered by this checkbox will cause input validation, default is true.
  • access: public
boolean getCausesValidation ()
getChecked (line 168)
  • return: whether the checkbox is checked
  • access: public
boolean getChecked ()
getClientClassName (line 426)

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:
getEnableClientScript (line 342)
  • return: whether to render javascript.
  • access: public
boolean getEnableClientScript ()

Redefined in descendants as:
getInputAttributes (line 308)
  • return: list of attributes to be rendered for the checkbox
  • access: public
TMap getInputAttributes ()
getLabelAttributes (line 293)
  • return: list of attributes to be rendered for label beside the checkbox
  • access: public
TMap getLabelAttributes ()

Redefined in descendants as:
getPostBackOptions (line 435)

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 119)
  • return: the text caption of the checkbox
  • access: public
string getText ()
getTextAlign (line 152)
  • return: the alignment (Left or Right) of the text caption, defaults to TTextAlign::Right.
  • access: public
TTextAlign getTextAlign ()
getValidationGroup (line 219)
  • return: the group of validators which the checkbox causes validation upon postback
  • access: public
string getValidationGroup ()
getValidationPropertyValue (line 111)

Returns the value of the property that needs validation.

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

Redefined in descendants as:
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:
onCheckedChanged (line 87)

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

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

Raises postdata changed event.

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

  • access: public
void raisePostDataChangedEvent ()
render (line 238)

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

Renders the client-script code.

  • access: protected
void renderClientControlScript (mixed $writer)

Redefined in descendants as:
renderInputTag (line 377)

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

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

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

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

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:
setEnableClientScript (line 350)
  • access: public
void setEnableClientScript (boolean $value)
  • boolean $value: whether to render javascript.

Redefined in descendants as:
setText (line 128)

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 160)
  • access: public
void setTextAlign (TTextAlign $value)
  • TTextAlign $value: the alignment of the text caption. Valid values include Left and Right.
setValidationGroup (line 227)
  • access: public
void setValidationGroup (string $value)
  • string $value: the group of validators which the checkbox causes validation upon postback
setValue (line 144)
  • access: public
void setValue (string $value)
  • string $value: the value of the checkbox

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::addToPostDataLoader()
TControl::applyStyleSheetSkin()
TControl::autoBindProperty()
TControl::autoDataBindProperties()
TControl::bindProperty()
TControl::broadcastEvent()
TControl::bubbleEvent()
TControl::clearChildState()
TControl::clearControlState()
TControl::clearNamingContainer()
TControl::clearViewState()
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::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, 14 Jan 2007 21:41:27 -0500 by phpDocumentor 1.3.0RC4