PHP Класс 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 {@link setText Text} property. The caption can appear either on the right or left of the check box, which is determined by the {@link setTextAlign TextAlign} property. To determine whether the TCheckBox component is checked, test the {@link getChecked Checked} property. The {@link onCheckedChanged OnCheckedChanged} event is raised when the {@link getChecked Checked} state of the TCheckBox 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 TCheckBox component changes between posts to the server. If {@link setAutoPostBack AutoPostBack} is set true, changing the check box 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.
С версии: 3.0
Автор: Qiang Xue ([email protected])
Наследование: extends TWebControl, implements Prado\Web\UI\IPostBackDataHandler, implements Prado\Web\UI\IValidatable, implements Prado\IDataRenderer, implements Prado\Web\UI\ISurroundable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
getAutoPostBack ( ) : boolean
getCausesValidation ( ) : boolean
getChecked ( ) : boolean
getData ( ) : boolean Returns the value indicating whether the checkbox is checked.
getDataChanged ( ) : boolean Returns a value indicating whether postback has caused the control data change.
getEnableClientScript ( ) : boolean
getInputAttributes ( ) : TMap
getIsValid ( ) : boolean Returns true if this control validated successfully.
getLabelAttributes ( ) : TMap
getSurroundingTag ( ) : string
getSurroundingTagID ( ) : string
getText ( ) : string
getTextAlign ( ) : TTextAlign
getValidationGroup ( ) : string
getValidationPropertyValue ( ) : mixed Returns the value of the property that needs validation.
getValue ( ) : string
loadPostData ( $key, $values ) : boolean Loads user input data.
onCheckedChanged ( $param ) Raises OnCheckedChanged event when {@link getChecked Checked} changes value during postback.
onPreRender ( $param ) Registers the checkbox to receive postback data during postback.
raisePostDataChangedEvent ( ) Raises postdata changed event.
render ( $writer ) Renders the checkbox control.
setAutoPostBack ( $value ) Sets a value indicating whether clicking on the checkbox will post the page.
setCausesValidation ( $value ) Sets the value indicating whether postback event trigger by this checkbox will cause input validation.
setChecked ( $value ) Sets a value indicating whether the checkbox is to be checked or not.
setData ( $value ) Sets the value indicating whether the checkbox is to be checked or not.
setEnableClientScript ( $value )
setIsValid ( $value )
setText ( $value ) Sets the text caption of the checkbox.
setTextAlign ( $value )
setValidationGroup ( $value )
setValue ( $value )

Защищенные методы

Метод Описание
getClientClassName ( ) : string Gets the name of the javascript class responsible for performing postback for this control.
getPostBackOptions ( ) : array Gets the post back options for this checkbox.
getSpanNeeded ( ) : boolean 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.
getTagName ( ) : string
getValueAttribute ( ) : string
renderClientControlScript ( $writer ) Renders the client-script code.
renderInputTag ( $writer, $clientID, $onclick ) Renders a checkbox input element.
renderLabel ( $writer, $clientID, $text ) Renders a label beside the checkbox.

Описание методов

getAutoPostBack() публичный Метод

public getAutoPostBack ( ) : boolean
Результат boolean whether clicking on the checkbox will post the page.

getCausesValidation() публичный Метод

public getCausesValidation ( ) : boolean
Результат boolean whether postback event triggered by this checkbox will cause input validation, default is true.

getChecked() публичный Метод

public getChecked ( ) : boolean
Результат boolean whether the checkbox is checked

getClientClassName() защищенный Метод

This method overrides the parent implementation.
protected getClientClassName ( ) : string
Результат string the javascript class name

getData() публичный Метод

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link getChecked()}.
См. также: getChecked
С версии: 3.1.0
public getData ( ) : boolean
Результат boolean whether the checkbox is checked.

getDataChanged() публичный Метод

This method is required by the \Prado\Web\UI\IPostBackDataHandler interface.
public getDataChanged ( ) : boolean
Результат boolean whether postback has caused the control data change. False if the page is not in postback mode.

getEnableClientScript() публичный Метод

public getEnableClientScript ( ) : boolean
Результат boolean whether to render javascript.

getInputAttributes() публичный Метод

public getInputAttributes ( ) : TMap
Результат TMap list of attributes to be rendered for the checkbox

getIsValid() публичный Метод

Defaults to true.
public getIsValid ( ) : boolean
Результат boolean wether this control validated successfully.

getLabelAttributes() публичный Метод

public getLabelAttributes ( ) : TMap
Результат TMap list of attributes to be rendered for label beside the checkbox

getPostBackOptions() защищенный Метод

Gets the post back options for this checkbox.
protected getPostBackOptions ( ) : array
Результат array

getSpanNeeded() защищенный Метод

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 getSpanNeeded ( ) : boolean
Результат boolean wether this control needs a surrounding span tag

getSurroundingTag() публичный Метод

public getSurroundingTag ( ) : string
Результат string the tag used to wrap the control in.

getSurroundingTagID() публичный Метод

public getSurroundingTagID ( ) : string
Результат string the id of the surrounding tag or this clientID if no such tag needed.

getTagName() защищенный Метод

protected getTagName ( ) : string
Результат string tag name of the button

getText() публичный Метод

public getText ( ) : string
Результат string the text caption of the checkbox

getTextAlign() публичный Метод

public getTextAlign ( ) : TTextAlign
Результат TTextAlign the alignment (Left or Right) of the text caption, defaults to TTextAlign::Right.

getValidationGroup() публичный Метод

public getValidationGroup ( ) : string
Результат string the group of validators which the checkbox causes validation upon postback

getValidationPropertyValue() публичный Метод

Returns the value of the property that needs validation.
public getValidationPropertyValue ( ) : mixed
Результат mixed the property value to be validated

getValue() публичный Метод

public getValue ( ) : string
Результат string the value of the checkbox. Defaults to empty.

getValueAttribute() защищенный Метод

protected getValueAttribute ( ) : string
Результат string the value attribute to be rendered

loadPostData() публичный Метод

This method is primarly used by framework developers.
public loadPostData ( $key, $values ) : boolean
Результат boolean whether the data of the control has been changed

onCheckedChanged() публичный Метод

If you override this method, be sure to call the parent implementation so that the event delegates can be invoked.
public onCheckedChanged ( $param )

onPreRender() публичный Метод

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 onPreRender ( $param )

raisePostDataChangedEvent() публичный Метод

This method raises {@link onCheckedChanged OnCheckedChanged} event. This method is primarly used by framework developers.

render() публичный Метод

This method overrides the parent implementation by rendering a checkbox input element and a span element if needed.
public render ( $writer )

renderClientControlScript() защищенный Метод

Renders the client-script code.
protected renderClientControlScript ( $writer )

renderInputTag() защищенный Метод

Renders a checkbox input element.
protected renderInputTag ( $writer, $clientID, $onclick )

renderLabel() защищенный Метод

Renders a label beside the checkbox.
protected renderLabel ( $writer, $clientID, $text )

setAutoPostBack() публичный Метод

Sets a value indicating whether clicking on the checkbox will post the page.
public setAutoPostBack ( $value )

setCausesValidation() публичный Метод

Sets the value indicating whether postback event trigger by this checkbox will cause input validation.
public setCausesValidation ( $value )

setChecked() публичный Метод

Sets a value indicating whether the checkbox is to be checked or not.
public setChecked ( $value )

setData() публичный Метод

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link setChecked()}.
См. также: setChecked
С версии: 3.1.0
public setData ( $value )

setEnableClientScript() публичный Метод

public setEnableClientScript ( $value )

setIsValid() публичный Метод

public setIsValid ( $value )

setText() публичный Метод

Sets the text caption of the checkbox.
public setText ( $value )

setTextAlign() публичный Метод

public setTextAlign ( $value )

setValidationGroup() публичный Метод

public setValidationGroup ( $value )

setValue() публичный Метод

public setValue ( $value )