Class \Prado\Web\UI\WebControls\TCheckBox
TCheckBox displays a check box on the page. You can specify the caption to display beside the check box by setting the \Prado\Web\UI\WebControls\setText property. The caption can appear either on the right or left of the check box, which is determined by the \Prado\Web\UI\WebControls\setTextAlign property.
To determine whether the TCheckBox 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 TCheckBox 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 TCheckBox component changes between posts to the server.
If \Prado\Web\UI\WebControls\setAutoPostBack is set true, changing the check box 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\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
|
|
public
|
|
public
|
|
public
|
getData() : bool
Returns the value indicating whether the checkbox is checked.
This method is required by IDataRenderer. It is the same as getChecked(). |
public
|
getDataChanged() : bool
Returns a value indicating whether postback has caused the control data change.
This method is required by the \Prado\Web\UI\IPostBackDataHandler interface. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
loadPostData(string $key, array<string|int, mixed> $values) : bool
Loads user input data.
This method is primarly used by framework developers. |
public
|
onCheckedChanged(TEventParameter $param) : mixed
Raises <b>OnCheckedChanged</b> event when {@see getChecked Checked} changes value during postback.
If you override this method, be sure to call the parent implementation so that the event delegates can be invoked. |
public
|
onPreRender(mixed $param) : mixed
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. |
public
|
raisePostDataChangedEvent() : mixed
Raises postdata changed event.
This method raises \Prado\Web\UI\WebControls\onCheckedChanged event. This method is primarly used by framework developers. |
public
|
render(THtmlWriter $writer) : mixed
Renders the checkbox control.
This method overrides the parent implementation by rendering a checkbox input element and a span element if needed. |
public
|
setAutoPostBack(bool $value) : mixed
Sets a value indicating whether clicking on the checkbox will post the page.
|
public
|
setCausesValidation(bool $value) : mixed
Sets the value indicating whether postback event trigger by this checkbox will cause input validation.
|
public
|
setChecked(bool $value) : mixed
Sets a value indicating whether the checkbox is to be checked or not.
|
public
|
setData(bool $value) : mixed
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(). |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
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
|
getSpanNeeded() : bool
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.
|
protected
|
|
protected
|
|
protected
|
|
protected
|
renderInputTag(THtmlWriter $writer, string $clientID, string $onclick) : mixed
Renders a checkbox input element.
|
protected
|
renderLabel(THtmlWriter $writer, string $clientID, string $text) : mixed
Renders a label beside the checkbox.
|