Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml


Classes:
Keyword

Class TCallbackClientScript

TComponent
   |
   --TApplicationComponent
      |
      --TCallbackClientScript

TCallbackClientScript class.

The TCallbackClientScript class provides corresponding methods that can be executed on the client-side (i.e. the browser client that is viewing the page) during a callback response.

The avaiable methods includes setting/clicking input elements, changing Css styles, hiding/showing elements, and adding visual effects to elements on the page. The client-side methods can be access through the CallbackClient property available in TPage.

For example, to hide "$myTextBox" element during callback response, do

  1. $this->getPage()->getCallbackClient()->hide($myTextBox);

Since: 3.1
Author: Wei Zhuo <weizhuo[at]gamil[dot]com>

Constructor Summary
public
Constructor.

Method Summary
void
addCssClass ( TControl $element, string $cssClass)
Add a Css class name to the element.
void
addPostDataLoader ( mixed $name)
void
appear ( TControl $element, array $options)
Visual Effect: Gradually make the element appear.
void
appendContent ( TControl $element, string $content)
Append a HTML fragement to the element.
void
blindDown ( TControl $element, array $options)
Visual Effect: Blind down.
void
blindUp ( TControl $element, array $options)
Visual Effect: Blind up.
void
callClientFunction ( string $function, array $params)
Executes a client-side statement.
void
check ( TControl $checkbox, boolean $checked)
Client script to check or uncheck a checkbox or radio button.
void
click ( TControl $control)
Client script to click on an element.
void
dropOut ( TControl $element, array $options)
Visual Effect: Drop out.
void
Evaluate a block of javascript enclosed in a boundary.
void
fade ( TControl $element, array $options)
Visual Effect: Gradually fade the element.
void
focus ( TControl $element)
Focus on a particular element.
void
fold ( TControl $element, array $options)
Visual Effect: Fold.
array
void
grow ( TControl $element, array $options)
Visual Effect: Gradually make an element grow to a predetermined size.
void
hide ( TControl $element)
Hides an element by changing its CSS display style to "none".
void
highlight ( TControl $element, array $options)
Visual Effect: High light the element for about 2 seconds.
void
insertContentAfter ( TControl $element, string $content)
Insert a HTML fragement after the element.
void
insertContentBefore ( TControl $element, string $content)
Insert a HTML fragement in before the element.
void
prependContent ( TControl $element, string $content)
Prepend a HTML fragement to the element.
void
puff ( TControl $element, array $options)
Visual Effect: Gradually grow and fade the element.
void
pulsate ( TControl $element, array $options)
Visual Effect: Pulsate.
void
raiseClientEvent ( TControl $control, string $eventName)
Raise the client side event (given by $eventName) on a particular element.
void
remove ( TControl $element)
Removes an element from the HTML page.
void
removeCssClass ( TControl $element, string $cssClass)
Remove a Css class name from the element.
protected  void
replace ( TControl $element, string $content, string $method, string $boundary)
Replace the content of an element with new content. The new content can be a string or a TControl component. If the <tt>content</tt> parameter is a TControl component, its rendered method will be called and its contents will be used for replacement.
void
replaceContent ( TControl $element, string $content)
Replace the content of an element with new content contained in writer.
void
scrollTo ( TControl $element)
Scroll the top of the browser viewing area to the location of the element.
void
select ( TControl $control, string $method, string|int $value, string $type)
Client script to select/clear/check a drop down list, check box list, or radio button list.
void
setAttribute ( TControl $control, string $name, string $value)
Sets the attribute of a particular control.
void
setListItems ( TControl $control, TCollection $items)
Sets the options of a select input element.
void
setOpacity ( TControl $element, float $value)
Set the opacity on a html element or control.
void
setStyle ( TControl $element, array $styles)
Sets the style of element. The style must be a key-value array where the key is the style property and the value is the style value.
void
setValue ( TControl $input, string $text)
Client script to set the value of a particular input element.
void
shake ( TControl $element, array $options)
Visual Effect: Shake the element.
void
show ( TControl $element)
Shows an element by changing its CSS display style as empty.
void
shrink ( TControl $element, array $options)
Visual Effect: Shrink the element.
void
slideDown ( TControl $element, array $options)
Visual Effect: Slide down.
void
slideUp ( TControl $element, array $options)
Visual Effect: Side up.
void
squish ( TControl $element, array $options)
Visual Effect: Squish the element.
void
switchOff ( TControl $element, array $options)
Visual Effect: Switch Off effect.
void
toggle ( TControl $element, string $effect, array $options)
Toggles the visibility of the element.
void
update ( TControl $element, TControl $content)
Update the element's innerHTML with new content.
void
visualEffect ( string $type, TControl $element, array $options)
Add a visual effect the element.
Methods Inherited From TApplicationComponent
TApplicationComponent::getApplication(), TApplicationComponent::getRequest(), TApplicationComponent::getResponse(), TApplicationComponent::getService(), TApplicationComponent::getSession(), TApplicationComponent::getUser(), TApplicationComponent::publishAsset(), TApplicationComponent::publishFilePath()
Methods Inherited From TComponent
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()

Constructor Details

__construct

public __construct

Constructor.


Method Details

addCssClass

public void addCssClass (TControl $element , string $cssClass )

Add a Css class name to the element.

Input
TControl$elementcontrol element or element id
string$cssClassCssClass name to add.
Output
Exception

addPostDataLoader

public void addPostDataLoader (mixed $name )

Input
mixed$name
Output
Exception

appear

public void appear (TControl $element , array $options )

Visual Effect: Gradually make the element appear.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

appendContent

public void appendContent (TControl $element , string $content )

Append a HTML fragement to the element.

Input
TControl$elementcontrol element or element id
string$contentHTML fragement or the control to be rendered
Output
Exception

blindDown

public void blindDown (TControl $element , array $options )

Visual Effect: Blind down.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

blindUp

public void blindUp (TControl $element , array $options )

Visual Effect: Blind up.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

callClientFunction

public void callClientFunction (string $function , array $params )

Executes a client-side statement.

Input
string$functionjavascript function name
array$paramslist of arguments for the function
Output
Exception

check

public void check (TControl $checkbox , boolean $checked )

Client script to check or uncheck a checkbox or radio button.

Input
TControl$checkboxcontrol element or element id
boolean$checkedcheck or uncheck the checkbox or radio button.
Output
Exception

click

public void click (TControl $control )

Client script to click on an element.

is unpredictable.</b>

Input
TControl$controlcontrol element or element id
Output
Exception

dropOut

public void dropOut (TControl $element , array $options )

Visual Effect: Drop out.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

evaluateScript

public void evaluateScript (THtmlWriter $writer )

Evaluate a block of javascript enclosed in a boundary.

Input
THtmlWriter$writerwriter for the content.
Output
Exception

fade

public void fade (TControl $element , array $options )

Visual Effect: Gradually fade the element.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

focus

public void focus (TControl $element )

Focus on a particular element.

Input
TControl$elementcontrol element or element id.
Output
Exception

fold

public void fold (TControl $element , array $options )

Visual Effect: Fold.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

getClientFunctionsToExecute

public array getClientFunctionsToExecute ()

Output
array list of client function to be executed during callback response.
Exception

grow

public void grow (TControl $element , array $options )

Visual Effect: Gradually make an element grow to a predetermined size.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

hide

public void hide (TControl $element )

Hides an element by changing its CSS display style to "none".

Input
TControl$elementcontrol element or element id
Output
Exception

highlight

public void highlight (TControl $element , array $options )

Visual Effect: High light the element for about 2 seconds.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

insertContentAfter

public void insertContentAfter (TControl $element , string $content )

Insert a HTML fragement after the element.

Input
TControl$elementcontrol element or element id
string$contentHTML fragement or the control to be rendered
Output
Exception

insertContentBefore

public void insertContentBefore (TControl $element , string $content )

Insert a HTML fragement in before the element.

Input
TControl$elementcontrol element or element id
string$contentHTML fragement or the control to be rendered
Output
Exception

prependContent

public void prependContent (TControl $element , string $content )

Prepend a HTML fragement to the element.

Input
TControl$elementcontrol element or element id
string$contentHTML fragement or the control to be rendered
Output
Exception

puff

public void puff (TControl $element , array $options )

Visual Effect: Gradually grow and fade the element.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

pulsate

public void pulsate (TControl $element , array $options )

Visual Effect: Pulsate.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

raiseClientEvent

public void raiseClientEvent (TControl $control , string $eventName )

Raise the client side event (given by $eventName) on a particular element.

Input
TControl$controlcontrol element or element id
string$eventNameEvent name, e.g. "click"
Output
Exception

remove

public void remove (TControl $element )

Removes an element from the HTML page.

Input
TControl$elementcontrol element or element id
Output
Exception

removeCssClass

public void removeCssClass (TControl $element , string $cssClass )

Remove a Css class name from the element.

Input
TControl$elementcontrol element or element id
string$cssClassCssClass name to remove.
Output
Exception

replace

protected void replace (TControl $element , string $content , string $method , string $boundary )

Replace the content of an element with new content. The new content can be a string or a TControl component. If the <tt>content</tt> parameter is a TControl component, its rendered method will be called and its contents will be used for replacement.

Input
TControl$elementcontrol element or HTML element id.
string$contentHTML fragement or the control to be rendered
string$methodreplacement method, default is to replace the outter html content.
string$boundaryprovide a custom boundary.
Output
Exception

replaceContent

public void replaceContent (TControl $element , string $content )

Replace the content of an element with new content contained in writer.

Input
TControl$elementcontrol element or HTML element id.
string$contentHTML fragement or the control to be rendered
Output
Exception

scrollTo

public void scrollTo (TControl $element )

Scroll the top of the browser viewing area to the location of the element.

Input
TControl$elementcontrol element or element id
Output
Exception

select

public void select (TControl $control , string $method , string|int $value , string $type )

Client script to select/clear/check a drop down list, check box list, or radio button list.

The second parameter determines the selection method. Valid methods are

  • Value, select or check by value
  • Values, select or check by a list of values
  • Index, select or check by index (zero based index)
  • Indices, select or check by a list of index (zero based index)
  • Clear, clears or selections or checks in the list
  • All, select all
  • Invert, invert the selection.

Input
TControl$controllist control
string$methodselection method
string|int$valuethe value or index to select/check.
string$typeselection control type, either 'check' or 'select'
Output
Exception

setAttribute

public void setAttribute (TControl $control , string $name , string $value )

Sets the attribute of a particular control.

Input
TControl$controlcontrol element or element id
string$nameattribute name
string$valueattribute value
Output
Exception

setListItems

public void setListItems (TControl $control , TCollection $items )

Sets the options of a select input element.

Input
TControl$controlcontrol element or element id
TCollection$itemsa list of new options
Output
Exception

setOpacity

public void setOpacity (TControl $element , float $value )

Set the opacity on a html element or control.

Input
TControl$elementcontrol element or element id
float$valueopacity value between 1 and 0
Output
Exception

setStyle

public void setStyle (TControl $element , array $styles )

Sets the style of element. The style must be a key-value array where the key is the style property and the value is the style value.

Input
TControl$elementcontrol element or element id
array$styleslist of key-value pairs as style property and style value.
Output
Exception

setValue

public void setValue (TControl $input , string $text )

Client script to set the value of a particular input element.

Input
TControl$inputcontrol element to set the new value
string$textnew value
Output
Exception

shake

public void shake (TControl $element , array $options )

Visual Effect: Shake the element.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

show

public void show (TControl $element )

Shows an element by changing its CSS display style as empty.

Input
TControl$elementcontrol element or element id
Output
Exception

shrink

public void shrink (TControl $element , array $options )

Visual Effect: Shrink the element.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

slideDown

public void slideDown (TControl $element , array $options )

Visual Effect: Slide down.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

slideUp

public void slideUp (TControl $element , array $options )

Visual Effect: Side up.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

squish

public void squish (TControl $element , array $options )

Visual Effect: Squish the element.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

switchOff

public void switchOff (TControl $element , array $options )

Visual Effect: Switch Off effect.

Input
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception

toggle

public void toggle (TControl $element , string $effect , array $options )

Toggles the visibility of the element.

Input
TControl$elementcontrol element or element id
string$effectvisual effect, such as, 'appear' or 'slide' or 'blind'.
array$optionsadditional options.
Output
Exception

update

public void update (TControl $element , TControl $content )

Update the element's innerHTML with new content.

Input
TControl$elementcontrol element or element id
TControl$contentnew HTML content, if content is of a TControl, the controls render method is called.
Output
Exception

visualEffect

public void visualEffect (string $type , TControl $element , array $options )

Add a visual effect the element.

Input
string$typevisual effect function name.
TControl$elementcontrol element or element id
array$optionsvisual effect key-value pair options.
Output
Exception