## Class TRadioButton

Description

TRadioButton class

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

To determine whether the TRadioButton component is checked, test the Checked property. The OnCheckedChanged event is raised when the Checked state of the TRadioButton 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 TRadioButton component changes between posts to the server.

TRadioButton uses GroupName to group together a set of radio buttons. Once the GroupName is set, you can use the getRadioButtonsInGroup method to get an array of TRadioButtons having the same group name.

If AutoPostBack is set true, changing the radio button 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: TRadioButton.php 2059 2007-07-19 12:26:26Z xue $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Web/UI/WebControls/TRadioButton.php (line 56)

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

Direct descendents

Class | Description
--- | ---
TActiveRadioButton | TActiveRadioButton class.

Method Summary
TRadioButton __construct ()
void addToPostDataLoader ()
string getClientClassName ()
boolean getEnableClientScript ()
string getGroupName ()
array getRadioButtonsInGroup ()
string getUniqueGroupName ()
string getValueAttribute ()
boolean loadPostData (string $key, array $values)
void onInit (TEventParameter $param)
void onUnLoad (TEventParameter $param)
void renderClientControlScript (mixed $writer)
void renderInputTag (THtmlWriter $writer, string $clientID, string $onclick)
void setEnableClientScript (boolean $value)
void setGroupName (string $value)
void setUniqueGroupName (string $value)
Methods
Constructor __construct (line 84)

Constructor.

Registers the radiobutton in a global radiobutton collection. If overridden, the parent implementation must be invoked first.

- access: public

TRadioButton __construct ()

Redefinition of:

TControl::__construct()
  Constructor.

Redefined in descendants as:

- TActiveRadioButton::__construct() : Creates a new callback control, sets the adapter to TActiveControlAdapter. If you override this class, be sure to set the adapter appropriately by, for example, by calling this constructor.

addToPostDataLoader (line 161)

Add the group name as post data loader if group name is set.

- access: protected

void addToPostDataLoader ()

Redefinition of:

TControl::addToPostDataLoader()
  Add controls implementing IPostBackDataHandler to post data loaders.

getClientClassName (line 315)

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

Redefinition of:

TCheckBox::getClientClassName()
  Gets the name of the javascript class responsible for performing postback for this control.

Redefined in descendants as:

- TActiveRadioButton::getClientClassName()

getEnableClientScript (line 249)

- return: whether to render javascript.
- access: public

boolean getEnableClientScript ()

Redefinition of:

TCheckBox::getEnableClientScript()

getGroupName (line 141)

- return: the name of the group that the radio button belongs to. Defaults to empty.
- access: public

string getGroupName ()
getRadioButtonsInGroup (line 223)

Gets an array of radiobuttons whose group name is the same as this radiobutton's.

Note, only those radiobuttons that are on the current page hierarchy may be returned in the result.

- return: list of TRadioButton with the same group
- access: public

array getRadioButtonsInGroup ()
getUniqueGroupName (line 171)

- return: the name used to fetch radiobutton post data
- access: public

string getUniqueGroupName ()
getValueAttribute (line 238)

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

string getValueAttribute ()

Redefinition of:

TCheckBox::getValueAttribute()

loadPostData (line 119)

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

Redefinition of:

TCheckBox::loadPostData()
  Loads user input data.

onInit (line 95)

Registers the radio button groupings. If overriding onInit method, ensure to call parent implemenation.

- access: public

void onInit (TEventParameter $param)

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

Redefinition of:

TControl::onInit()
  This method is invoked when the control enters 'OnInit' stage.

onUnLoad (line 106)

Unregisters the radio button groupings. If overriding onInit method, ensure to call parent implemenation.

- access: public

void onUnLoad (TEventParameter $param)

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

renderClientControlScript (line 304)

Renders the client-script code.

- access: protected

void renderClientControlScript (mixed $writer)

Redefinition of:

TCheckBox::renderClientControlScript()
  Renders the client-script code.

Redefined in descendants as:

- TActiveRadioButton::renderClientControlScript() : Override parent implementation, no javascript is rendered here instead the javascript required for active control is registered in addAttributesToRender.

renderInputTag (line 268)

Renders a radiobutton 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

Redefinition of:

TCheckBox::renderInputTag()
  Renders a checkbox input element.

Redefined in descendants as:

- TActiveRadioButton::renderInputTag() : Ensure that the ID attribute is rendered and registers the javascript code for initializing the active control.

setEnableClientScript (line 257)

- access: public

void setEnableClientScript (boolean $value)

- boolean $value: whether to render javascript.

Redefinition of:

TCheckBox::setEnableClientScript()

setGroupName (line 152)

Sets the name of the group that the radio button belongs to.

The group is unique among the control's naming container.

- access: public
- see: TRadioButton::setUniqueGroupName()

void setGroupName (string $value)

- string $value: the group name

setUniqueGroupName (line 212)

Sets the unique group name that the radio button belongs to.

A unique group is a radiobutton group unique among the whole page hierarchy, while the GroupName specifies a group that is unique among the control's naming container only. For example, each cell of a TDataGrid is a naming container. If you specify GroupName for a radiobutton in a cell, it groups together radiobutton within a cell, but not the other, even though they have the same GroupName. On the contratry, if UniqueGroupName is used instead, it will group all appropriate radio buttons on the whole page hierarchy. Note, when both UniqueGroupName and GroupName, the former takes precedence.

- access: public
- see: TRadioButton::setGroupName()

void setUniqueGroupName (string $value)

- string $value: the group name

#### Inherited Methods

Inherited From TCheckBox

> TCheckBox::getAutoPostBack()
> TCheckBox::getCausesValidation()
> TCheckBox::getChecked()
> TCheckBox::getClientClassName()
> TCheckBox::getData()
> TCheckBox::getDataChanged()
> TCheckBox::getEnableClientScript()
> TCheckBox::getInputAttributes()
> TCheckBox::getLabelAttributes()
> TCheckBox::getPostBackOptions()
> TCheckBox::getSpanNeeded()
> TCheckBox::getSurroundingTagID()
> TCheckBox::getTagName()
> TCheckBox::getText()
> TCheckBox::getTextAlign()
> TCheckBox::getValidationGroup()
> TCheckBox::getValidationPropertyValue()
> TCheckBox::getValue()
> TCheckBox::getValueAttribute()
> TCheckBox::loadPostData()
> TCheckBox::onCheckedChanged()
> TCheckBox::onPreRender()
> TCheckBox::raisePostDataChangedEvent()
> TCheckBox::render()
> TCheckBox::renderClientControlScript()
> TCheckBox::renderInputTag()
> TCheckBox::renderLabel()
> TCheckBox::setAutoPostBack()
> TCheckBox::setCausesValidation()
> TCheckBox::setChecked()
> TCheckBox::setData()
> TCheckBox::setEnableClientScript()
> TCheckBox::setText()
> TCheckBox::setTextAlign()
> TCheckBox::setValidationGroup()
> TCheckBox::setValue()

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

#### Inherited Constants

Inherited from TControl

> TControl::AUTOMATIC_ID_PREFIX
> TControl::CLIENT_ID_SEPARATOR
> TControl::CS_CHILD_INITIALIZED
> TControl::CS_CONSTRUCTED
> TControl::CS_INITIALIZED
> TControl::CS_LOADED
> TControl::CS_PRERENDERED
> TControl::CS_STATE_LOADED
> TControl::ID_FORMAT
> TControl::ID_SEPARATOR
> TControl::IS_CHILD_CREATED
> TControl::IS_CREATING_CHILD
> TControl::IS_DISABLE_THEMING
> TControl::IS_DISABLE_VIEWSTATE
> TControl::IS_ID_SET
> TControl::IS_SKIN_APPLIED
> TControl::IS_STYLESHEET_APPLIED
> TControl::RF_ADAPTER
> TControl::RF_AUTO_BINDINGS
> TControl::RF_CHILD_STATE
> TControl::RF_CONTROLS
> TControl::RF_CONTROLSTATE
> TControl::RF_DATA_BINDINGS
> TControl::RF_EVENTS
> TControl::RF_NAMED_CONTROLS
> TControl::RF_NAMED_CONTROLS_ID
> TControl::RF_NAMED_OBJECTS
> TControl::RF_SKIN_ID

Documentation generated on Mon, 21 Apr 2008 11:35:55 -0400 by phpDocumentor 1.3.0RC4