PHP Класс Prado\Web\UI\WebControls\TButton

TButton creates a click button on the page. It is mainly used to submit data to a page. TButton raises two server-side events, {@link onClick OnClick} and {@link onCommand OnCommand}, when it is clicked on the client-side. The difference between these two events is that the event {@link onCommand OnCommand} is bubbled up to the button's ancestor controls. And within the event parameter for {@link onCommand OnCommand} contains the reference to the {@link setCommandName CommandName} and {@link setCommandParameter CommandParameter} property values that are set for the button object. This allows you to create multiple TButton components on a Web page and programmatically determine which one is clicked with what parameter. Clicking on button can also trigger form validation, if {@link setCausesValidation CausesValidation} is true. The validation may be restricted within a certain group of validator controls by setting {@link setValidationGroup ValidationGroup} property. If validation is successful, the data will be post back to the same page. TButton displays the {@link setText Text} property as the button caption. TButton can be one of three {@link setButtonType ButtonType}: Submit, Button and Reset. By default, it is a Submit button and the form submission uses the browser's default submission capability. If it is Button or Reset, postback may occur if one of the following conditions is met: - an event handler is attached to {@link onClick OnClick} event; - an event handler is attached to {@link onCommand OnCommand} event; - the button is in a non-empty validation group. In addition, clicking on a Reset button will clear up all input fields if the button does not cause a postback.
С версии: 3.0
Автор: Qiang Xue ([email protected])
Наследование: extends TWebControl, implements Prado\Web\UI\IPostBackEventHandler, implements Prado\Web\UI\IButtonControl, implements Prado\IDataRenderer
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
getButtonTag ( ) : TButtonTag
getButtonType ( ) : TButtonType
getCausesValidation ( ) : boolean
getCommandName ( ) : string
getCommandParameter ( ) : string
getData ( ) : string Returns the caption of the button.
getEnableClientScript ( ) : boolean
getIsDefaultButton ( ) : boolean
getText ( ) : string
getValidationGroup ( ) : string
onClick ( $param ) This method is invoked when the button is clicked.
onCommand ( $param ) This method is invoked when the button is clicked.
raisePostBackEvent ( $param ) Raises the postback event.
renderContents ( $writer ) Renders the body content enclosed between the control tag.
setButtonTag ( $value )
setButtonType ( $value )
setCausesValidation ( $value )
setCommandName ( $value )
setCommandParameter ( $value )
setData ( $value ) Sets the caption of the button.
setEnableClientScript ( $value )
setIsDefaultButton ( $value )
setText ( $value )
setValidationGroup ( $value )

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

Метод Описание
addAttributesToRender ( $writer ) Adds attribute name-value pairs to renderer.
canCauseValidation ( ) : boolean
getClientClassName ( ) : string Gets the name of the javascript class responsible for performing postback for this control.
getPostBackOptions ( ) : array Returns postback specifications for the button.
getTagName ( ) : string
needPostBackScript ( ) : boolean
renderClientControlScript ( $writer ) Renders the client-script code.

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

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

This overrides the parent implementation with additional button specific attributes.
protected addAttributesToRender ( $writer )

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

protected canCauseValidation ( ) : boolean
Результат boolean whether to perform validation if the button is clicked

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

public getButtonTag ( ) : TButtonTag
Результат TButtonTag the tag name of the button. Defaults to TButtonType::Input.

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

public getButtonType ( ) : TButtonType
Результат TButtonType the type of the button. Defaults to TButtonType::Submit.

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

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

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

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

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

public getCommandName ( ) : string
Результат string the command name associated with the {@link onCommand OnCommand} event.

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

public getCommandParameter ( ) : string
Результат string the parameter associated with the {@link onCommand OnCommand} event

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

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link getText()}.
См. также: getText
С версии: 3.1.0
public getData ( ) : string
Результат string caption of the button.

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

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

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

public getIsDefaultButton ( ) : boolean
Результат boolean true if this button is registered as a default button for a panel.

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

This method is used by framework and control developers.
protected getPostBackOptions ( ) : array
Результат array parameters about how the button defines its postback behavior.

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

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

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

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

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

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

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

protected needPostBackScript ( ) : boolean
Результат boolean whether the button needs javascript to do postback

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

The method raises 'OnClick' event to fire up the event handlers. If you override this method, be sure to call the parent implementation so that the event handler can be invoked.
public onClick ( $param )

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

The method raises 'OnCommand' event to fire up the event handlers. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.
public onCommand ( $param )

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

This method is required by {@link IPostBackEventHandler} interface. If {@link getCausesValidation CausesValidation} is true, it will invoke the page's {@link TPage::validate validate} method first. It will raise {@link onClick OnClick} and {@link onCommand OnCommand} events. This method is mainly used by framework and control developers.
public raisePostBackEvent ( $param )

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

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

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

This overrides the parent implementation with nothing to be rendered for input tags, button tags are rendered normally.
public renderContents ( $writer )

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

public setButtonTag ( $value )

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

public setButtonType ( $value )

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

public setCausesValidation ( $value )

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

public setCommandName ( $value )

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

public setCommandParameter ( $value )

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

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

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

public setEnableClientScript ( $value )

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

public setIsDefaultButton ( $value )

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

public setText ( $value )

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

public setValidationGroup ( $value )