Class \Prado\Web\UI\WebControls\TImageButton
TImageButton creates an image button on the page. It is used to submit data to a page. 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 TImageButton control 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. The coordinates of the clicking point can be obtained from the \Prado\Web\UI\WebControls\onClick event parameter, which is of type TImageClickEventParameter.
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.
TImageButton displays the \Prado\Web\UI\WebControls\setText property as the hint text to the displayed image.
Class hierarchy
- \Prado\Web\UI\WebControls\TImageButton implements IPostBackDataHandler, IPostBackEventHandler, IButtonControl
- \Prado\Web\UI\WebControls\TImage implements 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
|
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
|
loadPostData(string $key, array<string|int, mixed> $values) : bool
This method checks if the TImageButton is clicked and loads the coordinates of the clicking position.
This method is primarly used by framework developers. |
public
|
onClick(TImageClickEventParameter $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
|
onPreRender(mixed $param) : mixed
Registers the image button to receive postback data during postback.
This is necessary because an image button, when postback, does not have direct mapping between post data and the image button name. This method overrides the parent implementation and is invoked before render. |
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
|
raisePostDataChangedEvent() : mixed
A dummy implementation for the \Prado\Web\UI\IPostBackDataHandler interface.
|
public
|
renderContents(THtmlWriter $writer) : mixed
Renders the body content enclosed between the control tag.
This overrides the parent implementation with nothing to be rendered. |
public
|
|
public
|
|
public
|
|
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
|
|
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
|