PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TButton

TButton class

TButton creates a click button on the page. It is mainly used to submit data to a page.

TButton raises two server-side events, onClick OnClick and onCommand OnCommand, when it is clicked on the client-side. The difference between these two events is that the event onCommand OnCommand is bubbled up to the button's ancestor controls. And within the event parameter for onCommand OnCommand contains the reference to the setCommandName CommandName and 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 setCausesValidation CausesValidation is true. The validation may be restricted within a certain group of validator controls by setting setValidationGroup ValidationGroup property. If validation is successful, the data will be post back to the same page.

TButton displays the setText Text property as the button caption.

TButton can be one of three 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 onClick OnClick event;
  • an event handler is attached to 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.

TComponent
Extended by TApplicationComponent
Extended by TControl implements IRenderable, IBindable
Extended by TWebControl implements IStyleable
Extended by TButton implements IPostBackEventHandler, IButtonControl, IDataRenderer

Direct known subclasses

TActiveButton
Package: System\Web\UI\WebControls
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 3.0
Located at Web/UI/WebControls/TButton.php
Methods summary
protected string
# getTagName( )

Returns

string
tag name of the button

Overrides

TWebControl::getTagName()
public boolean
# getEnableClientScript( )

Returns

boolean
whether to render javascript.
public
# setEnableClientScript( boolean $value )

Parameters

$value
boolean
whether to render javascript.
protected
# addAttributesToRender( THtmlWriter $writer )

Adds attribute name-value pairs to renderer. This overrides the parent implementation with additional button specific attributes.

Adds attribute name-value pairs to renderer. This overrides the parent implementation with additional button specific attributes.

Parameters

$writer
THtmlWriter
the writer used for the rendering purpose

Overrides

TWebControl::addAttributesToRender()
protected
# renderClientControlScript( mixed $writer )

Renders the client-script code.

Renders the client-script code.

protected string
# getClientClassName( )

Gets the name of the javascript class responsible for performing postback for this control. This method overrides the parent implementation.

Gets the name of the javascript class responsible for performing postback for this control. This method overrides the parent implementation.

Returns

string
the javascript class name
protected boolean
# canCauseValidation( )

Returns

boolean
whether to perform validation if the button is clicked
public
# setIsDefaultButton( boolean $value )

Parameters

$value
boolean
set by a panel to register this button as the default button for the panel.

Implementation of

IButtonControl::setIsDefaultButton()
public boolean
# getIsDefaultButton( )

Returns

boolean
true if this button is registered as a default button for a panel.

Implementation of

IButtonControl::getIsDefaultButton()
protected boolean
# needPostBackScript( )

Returns

boolean
whether the button needs javascript to do postback
protected array
# getPostBackOptions( )

Returns postback specifications for the button. This method is used by framework and control developers.

Returns postback specifications for the button. This method is used by framework and control developers.

Returns

array
parameters about how the button defines its postback behavior.
public
# renderContents( THtmlWriter $writer )

Renders the body content enclosed between the control tag. This overrides the parent implementation with nothing to be rendered.

Renders the body content enclosed between the control tag. This overrides the parent implementation with nothing to be rendered.

Parameters

$writer
THtmlWriter
the writer used for the rendering purpose

Overrides

TWebControl::renderContents()
public
# onClick( TEventParameter $param )

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.

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.

Parameters

$param
TEventParameter
event parameter to be passed to the event handlers

Implementation of

IButtonControl::onClick()
public
# onCommand( TCommandEventParameter $param )

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.

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.

Parameters

$param
TCommandEventParameter
event parameter to be passed to the event handlers

Implementation of

IButtonControl::onCommand()
public
# raisePostBackEvent( TEventParameter $param )

Raises the postback event. This method is required by IPostBackEventHandler interface. If getCausesValidation CausesValidation is true, it will invoke the page's TPage::validate validate method first. It will raise onClick OnClick and onCommand OnCommand events. This method is mainly used by framework and control developers.

Raises the postback event. This method is required by IPostBackEventHandler interface. If getCausesValidation CausesValidation is true, it will invoke the page's TPage::validate validate method first. It will raise onClick OnClick and onCommand OnCommand events. This method is mainly used by framework and control developers.

Parameters

$param
TEventParameter
the event parameter

Implementation of

IPostBackEventHandler::raisePostBackEvent()
public string
# getText( )

Returns

string
caption of the button

Implementation of

IButtonControl::getText()
public
# setText( string $value )

Parameters

$value
string
caption of the button

Implementation of

IButtonControl::setText()
public string
# getData( )

Returns the caption of the button. This method is required by IDataRenderer. It is the same as TButton::getText().

Returns the caption of the button. This method is required by IDataRenderer. It is the same as TButton::getText().

Returns

string
caption of the button.

Since

3.1.0

See

TButton::getText()

Implementation of

IDataRenderer::getData()
public
# setData( string $value )

Sets the caption of the button. This method is required by IDataRenderer. It is the same as TButton::setText().

Sets the caption of the button. This method is required by IDataRenderer. It is the same as TButton::setText().

Parameters

$value
string
caption of the button

Since

3.1.0

See

TButton::setText()

Implementation of

IDataRenderer::setData()
public boolean
# getCausesValidation( )

Returns

boolean
whether postback event trigger by this button will cause input validation, default is true

Implementation of

IButtonControl::getCausesValidation()
public
# setCausesValidation( boolean $value )

Parameters

$value
boolean
whether postback event trigger by this button will cause input validation

Implementation of

IButtonControl::setCausesValidation()
public string
# getCommandName( )

Returns

string
the command name associated with the onCommand OnCommand event.

Implementation of

IButtonControl::getCommandName()
public
# setCommandName( string $value )

Parameters

$value
string
the command name associated with the onCommand OnCommand event.

Implementation of

IButtonControl::setCommandName()
public string
# getCommandParameter( )

Returns

string
the parameter associated with the onCommand OnCommand event

Implementation of

IButtonControl::getCommandParameter()
public
# setCommandParameter( string $value )

Parameters

$value
string
the parameter associated with the onCommand OnCommand event.

Implementation of

IButtonControl::setCommandParameter()
public string
# getValidationGroup( )

Returns

string
the group of validators which the button causes validation upon postback

Implementation of

IButtonControl::getValidationGroup()
public
# setValidationGroup( string $value )

Parameters

$value
string
the group of validators which the button causes validation upon postback

Implementation of

IButtonControl::setValidationGroup()
public TButtonType
# getButtonType( )

Returns

TButtonType
the type of the button. Defaults to TButtonType::Submit.
public
# setButtonType( TButtonType $value )

Parameters

$value
TButtonType
the type of the button.
Methods inherited from TWebControl
clearStyle(), copyBaseAttributes(), createStyle(), getAccessKey(), getBackColor(), getBorderColor(), getBorderStyle(), getBorderWidth(), getCssClass(), getDecorator(), getDisplay(), getEnsureId(), getFont(), getForeColor(), getHasStyle(), getHeight(), getStyle(), getTabIndex(), getToolTip(), getWidth(), onPreRender(), render(), renderBeginTag(), renderEndTag(), setAccessKey(), setBackColor(), setBorderColor(), setBorderStyle(), setBorderWidth(), setCssClass(), setDisplay(), setEnsureId(), setForeColor(), setHeight(), setStyle(), setTabIndex(), setToolTip(), setWidth()
Methods inherited from TControl
__construct(), __get(), addParsedObject(), addToPostDataLoader(), addedControl(), applyStyleSheetSkin(), autoBindProperty(), autoDataBindProperties(), bindProperty(), broadcastEvent(), bubbleEvent(), clearChildState(), clearControlState(), clearNamingContainer(), clearViewState(), convertUniqueIdToClientId(), createChildControls(), createControlCollection(), dataBind(), dataBindChildren(), dataBindProperties(), ensureChildControls(), findControl(), findControlsByID(), findControlsByType(), focus(), getAdapter(), getAllowChildControls(), getAttribute(), getAttributes(), getChildControlsCreated(), getClientID(), getControlStage(), getControlState(), getControls(), getCustomData(), getEnableTheming(), getEnableViewState(), getEnabled(), getHasAdapter(), getHasAttributes(), getHasChildInitialized(), getHasControls(), getHasInitialized(), getHasLoaded(), getHasLoadedPostData(), getHasPreRendered(), getID(), getIsSkinApplied(), getNamingContainer(), getPage(), getParent(), getRegisteredObject(), getSkinID(), getSourceTemplateControl(), getTemplateControl(), getUniqueID(), getViewState(), getVisible(), hasAttribute(), initRecursive(), isDescendentOf(), isObjectRegistered(), loadRecursive(), loadState(), loadStateRecursive(), onDataBinding(), onInit(), onLoad(), onUnload(), preRenderRecursive(), raiseBubbleEvent(), registerObject(), removeAttribute(), removedControl(), renderChildren(), renderControl(), saveState(), saveStateRecursive(), setAdapter(), setAttribute(), setChildControlsCreated(), setControlStage(), setControlState(), setCustomData(), setEnableTheming(), setEnableViewState(), setEnabled(), setID(), setPage(), setSkinID(), setTemplateControl(), setViewState(), setVisible(), trackViewState(), traverseChildControls(), unbindProperty(), unloadRecursive(), unregisterObject()
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __destruct(), __isset(), __set(), __sleep(), __unset(), __wakeup(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants inherited from TControl
AUTOMATIC_ID_PREFIX, CLIENT_ID_SEPARATOR, CS_CHILD_INITIALIZED, CS_CONSTRUCTED, CS_INITIALIZED, CS_LOADED, CS_PRERENDERED, CS_STATE_LOADED, ID_FORMAT, ID_SEPARATOR, IS_CHILD_CREATED, IS_CREATING_CHILD, IS_DISABLE_THEMING, IS_DISABLE_VIEWSTATE, IS_ID_SET, IS_SKIN_APPLIED, IS_STYLESHEET_APPLIED, RF_ADAPTER, RF_AUTO_BINDINGS, RF_CHILD_STATE, RF_CONTROLS, RF_CONTROLSTATE, RF_DATA_BINDINGS, RF_EVENTS, RF_NAMED_CONTROLS, RF_NAMED_CONTROLS_ID, RF_NAMED_OBJECTS, RF_SKIN_ID
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Properties inherited from TWebControl
$_decorator
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO