Class \Prado\Web\UI\WebControls\TLinkButton
TLinkButton creates a hyperlink style button on the page. TLinkButton has the same appearance as a hyperlink. However, it is mainly used to submit data to a page. Like TButton, you can create either a submit button or a command button.
A command button has a command name (specified by the \Prado\Web\UI\WebControls\setCommandName property) and and a command parameter (specified by \Prado\Web\UI\WebControls\setCommandParameter property) associated with the button. This allows you to create multiple TLinkButton components on a Web page and programmatically determine which one is clicked with what parameter. You can provide an event handler for \Prado\Web\UI\WebControls\onCommand event to programmatically control the actions performed when the command button is clicked. In the event handler, you can determine the \Prado\Web\UI\WebControls\setCommandName property value and the \Prado\Web\UI\WebControls\setCommandParameter property value through the \Prado\Web\UI\WebControls\TCommandParameter::getName and \Prado\Web\UI\WebControls\TCommandParameter::getParameter properties of the event parameter which is of type TCommandEventParameter.
A submit button does not have a command name associated with the button and clicking on it simply posts the Web page back to the server. By default, a TLinkButton component is a submit button. You can provide an event handler for the \Prado\Web\UI\WebControls\onClick event to programmatically control the actions performed when the submit button is clicked.
Clicking on button can trigger form validation, if \Prado\Web\UI\WebControls\setCausesValidation is true. And the validation may be restricted within a certain group of validator controls by setting \Prado\Web\UI\WebControls\setValidationGroup property. If validation is successful, the data will be post back to the same page.
TLinkButton will display the \Prado\Web\UI\WebControls\setText property value as the hyperlink text. If \Prado\Web\UI\WebControls\setText is empty, the body content of TLinkButton will be displayed. Therefore, you can use TLinkButton as an image button by enclosing an <img> tag as the body of TLinkButton.
Class hierarchy
- \Prado\Web\UI\WebControls\TLinkButton implements IPostBackEventHandler, IButtonControl, IDataRenderer
- \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() : string
Returns the caption of the button.
This method is required by IDataRenderer. It is the same as getText(). |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
onClick(TEventParameter $param) : mixed
This method is invoked when the button is clicked.
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
|
onCommand(TCommandEventParameter $param) : mixed
This method is invoked when the button is clicked.
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
|
raisePostBackEvent(TEventParameter $param) : mixed
Raises the postback event.
This method is required by IPostBackEventHandler interface. If \Prado\Web\UI\WebControls\getCausesValidation is true, it will invoke the page's \Prado\Web\UI\TPage::validate method first. It will raise \Prado\Web\UI\WebControls\onClick and \Prado\Web\UI\WebControls\onCommand events. This method is mainly used by framework and control developers. |
public
|
renderContents(THtmlWriter $writer) : mixed
Renders the body content enclosed between the control tag.
If \Prado\Web\UI\WebControls\getText is not empty, it will be rendered. Otherwise, the body content enclosed in the control tag will be rendered. |
public
|
setCausesValidation(bool $value) : mixed
Sets the value indicating whether postback event trigger by this button will cause input validation.
|
public
|
|
public
|
|
public
|
setData(string $value) : mixed
Sets the caption of the button.
This method is required by IDataRenderer. It is the same as setText(). |
public
|
|
public
|
|
public
|
|
public
|
|
protected
|
addAttributesToRender(THtmlWriter $writer) : mixed
Adds attribute name-value pairs to renderer.
This overrides the parent implementation with additional button specific attributes. |
protected
|
getClientClassName() : string
Gets the name of the javascript class responsible for performing postback for this control.
This method overrides the parent implementation. |
protected
|
getPostBackOptions() : array<string|int, mixed>
Returns postback specifications for the button.
This method is used by framework and control developers. |
protected
|
|
protected
|
|
protected
|