Class \Prado\Web\UI\WebControls\TRadioButton
TRadioButton displays a radio button on the page. You can specify the caption to display beside the radio buttonby setting the \Prado\Web\UI\WebControls\setText property. The caption can appear either on the right or left of the radio button, which is determined by the \Prado\Web\UI\WebControls\setTextAlign property.
To determine whether the TRadioButton component is checked, test the \Prado\Web\UI\WebControls\getChecked property. The \Prado\Web\UI\WebControls\onCheckedChanged event is raised when the \Prado\Web\UI\WebControls\getChecked state of the TRadioButton component changes between posts to the server. You can provide an event handler for the \Prado\Web\UI\WebControls\onCheckedChanged event to to programmatically control the actions performed when the state of the TRadioButton component changes between posts to the server.
TRadioButton uses \Prado\Web\UI\WebControls\setGroupName to group together a set of radio buttons. Once the \Prado\Web\UI\WebControls\setGroupName is set, you can use the getRadioButtonsInGroup method to get an array of TRadioButtons having the same group name.
If \Prado\Web\UI\WebControls\setAutoPostBack is set true, changing the radio button state will cause postback action. And if \Prado\Web\UI\WebControls\setCausesValidation is true, validation will also be processed, which can be further restricted within a \Prado\Web\UI\WebControls\setValidationGroup.
Note, \Prado\Web\UI\WebControls\setText is rendered as is. Make sure it does not contain unwanted characters that may bring security vulnerabilities.
Class hierarchy
- \Prado\Web\UI\WebControls\TRadioButton
- \Prado\Web\UI\WebControls\TCheckBox implements IPostBackDataHandler, IValidatable, IDataRenderer, ISurroundable
- \Prado\Web\UI\WebControls\TWebControl implements IStyleable
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.0
public
|
__construct() : mixed
Constructor.
Registers the radiobutton in a global radiobutton collection. If overridden, the parent implementation must be invoked first. |
public
|
|
public
|
|
public
|
getRadioButtonsInGroup() : array<string|int, mixed>
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. |
public
|
|
public
|
loadPostData(string $key, array<string|int, mixed> $values) : bool
Loads user input data.
This method is primarly used by framework developers. |
public
|
onInit(TEventParameter $param) : mixed
Registers the radio button groupings. If overriding onInit method,
ensure to call parent implemenation.
|
public
|
onUnLoad(TEventParameter $param) : mixed
Unregisters the radio button groupings. If overriding onInit method,
ensure to call parent implemenation.
|
public
|
|
public
|
setGroupName(string $value) : mixed
Sets the name of the group that the radio button belongs to.
The group is unique among the control's naming container. |
public
|
setUniqueGroupName(string $value) : mixed
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 \Prado\Web\UI\WebControls\setGroupName 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 \Prado\Web\UI\WebControls\setGroupName for a radiobutton in a cell, it groups together radiobutton within a cell, but not the other, even though they have the same \Prado\Web\UI\WebControls\setGroupName. On the contratry, if \Prado\Web\UI\WebControls\setUniqueGroupName is used instead, it will group all appropriate radio buttons on the whole page hierarchy. Note, when both \Prado\Web\UI\WebControls\setUniqueGroupName and \Prado\Web\UI\WebControls\setGroupName, the former takes precedence. |
protected
|
getClientClassName() : string
Gets the name of the javascript class responsible for performing postback for this control.
This method overrides the parent implementation. |
protected
|
|
protected
|
|
protected
|
renderInputTag(THtmlWriter $writer, string $clientID, string $onclick) : mixed
Renders a radiobutton input element.
|