TRadioButton displays a radio button on the page. You can specify the caption to display beside the radio buttonby setting the {@link setText Text} property. The caption can appear either on the right or left of the radio button, which is determined by the {@link setTextAlign TextAlign} property. To determine whether the TRadioButton component is checked, test the {@link getChecked Checked} property. The {@link onCheckedChanged OnCheckedChanged} event is raised when the {@link getChecked Checked} state of the TRadioButton component changes between posts to the server. You can provide an event handler for the {@link onCheckedChanged OnCheckedChanged} event to to programmatically control the actions performed when the state of the TRadioButton component changes between posts to the server. TRadioButton uses {@link setGroupName GroupName} to group together a set of radio buttons. Once the {@link setGroupName GroupName} is set, you can use the {@link getRadioButtonsInGroup} method to get an array of TRadioButtons having the same group name. If {@link setAutoPostBack AutoPostBack} is set true, changing the radio button state will cause postback action. And if {@link setCausesValidation CausesValidation} is true, validation will also be processed, which can be further restricted within a {@link setValidationGroup ValidationGroup}. Note, {@link setText Text} is rendered as is. Make sure it does not contain unwanted characters that may bring security vulnerabilities.
Since: 3.0
Author: Qiang Xue (qiang.xue@gmail.com)
Inheritance: extends TCheckBox
Exemplo n.º 1
0
 /**
  * Override client implementation to avoid emitting the javascript
  *
  * @param THtmlWriter the writer for the rendering purpose
  * @param string checkbox id
  * @param string onclick js
  */
 protected function renderInputTag($writer, $clientID, $onclick)
 {
     TRadioButton::renderInputTag($writer, $clientID, $onclick);
 }
Exemplo n.º 2
0
 /**
  * Renders a label beside the radio button.
  * @param THtmlWriter the writer for the rendering purpose
  * @param string radio button id
  * @param string label text
  */
 protected function renderLabel($writer, $clientID, $text)
 {
     $writer->addAttribute('id', $this->getDefaultLabelID());
     parent::renderLabel($writer, $clientID, $text);
 }