Class ZFormAjaxBehavior

Description

Located in /Form/behaviors/ZFormAjaxBehavior.php (line 53)

ZFormElementBehavior
   |
   --ZFormAjaxBehavior
Class Constant Summary
 APPEND = 3
 GET = "GET"
 POST = "POST"
 PREPEND = 2
 REPLACE = 1
Variable Summary
 mixed $_callbacks
 mixed $_eventHook
 mixed $_htmlid
 mixed $_isAsync
 mixed $_method
 mixed $_position
 mixed $_url
Method Summary
 void __construct (ZFormElement $formElement, string $url, string $htmlid, [int $position = self::REPLACE], [ $callbacks = null], [boolean $isAsync = true], [string $method = self::POST], [string $eventHook = 'click'], array $callback)
 void emitClientBehavior (ZFormElement $element)
 boolean getCallbacks ()
 string getHTMLTarget ()
 string getPosition ()
 string getURL ()
 boolean isAsync ()
 void setAsync (boolean $isAsync)
 void setCallbacks ( $callbacks, array $callback)
 void setHTMLTarget (string $id)
 void setPosition ( $position, string $id)
 void setURL (string $url)
Variables
mixed $_callbacks (line 63)
  • access: protected
mixed $_eventHook (line 68)
  • access: protected
mixed $_htmlid (line 64)
  • access: protected
mixed $_isAsync (line 62)
  • access: protected
mixed $_method (line 66)
  • access: protected
mixed $_position (line 65)
  • access: protected
mixed $_scriptEventName (line 67)
  • access: protected
mixed $_url (line 61)
  • access: protected
Methods
Constructor __construct (line 94)

Class constructor. Simply initialize the instance variables to the variables passed

  • access: public
void __construct (ZFormElement $formElement, string $url, string $htmlid, [int $position = self::REPLACE], [ $callbacks = null], [boolean $isAsync = true], [string $method = self::POST], [string $eventHook = 'click'], array $callback)
  • ZFormElement $formElement: The element to apply the behavior to
  • string $url: the URL to invoke when the $eventHook occurs on the client
  • int $position: Determins how the content received by the AJAX request is placed into the receiving htmlid. Values are REPLACE, PREPEND & APPEND
  • array $callback: An array of Javascript code fragments that are called during the lifecycle of the AJAX request. $callbacks['onSuccess'] = "alert('success!') $callbacks['onFailure'] = "alert('failure!')
  • boolean $isAsync: true (default) make the AJAX request asynchronous
  • string $method: POST or GET
  • string $eventHook: The name of the client DOM event to hook which invokes the AJAX call.
  • string $htmlid: htmlid The id of the HTML component to target the result of the AJAX request at.
  • $callbacks
applyClientBehavior (line 169)

Called before the behavior is emitted to the client or server. If the element is a ZFormLink the AJAX behavior replaces the href of the link.

If the $element type is a form the submit event is hooked.

  • access: public
void applyClientBehavior (ZFormElement $element)
emitClientBehavior (line 123)

ZFormElementBehavior procotol method which emits the javascript necessary to apply the AJAX behavior to the element

  • access: public
void emitClientBehavior (ZFormElement $element)
getCallbacks (line 225)

Returns the value of the callbacks instance variable

  • access: public
boolean getCallbacks ()
getHTMLTarget (line 249)

Returns the value of the htmlid instance variable

  • access: public
string getHTMLTarget ()
getPosition (line 269)

Returns the value of the position instance variable

  • access: public
string getPosition ()
getURL (line 183)

Returns the URL of the AJAX behavior

  • return: url
  • access: public
string getURL ()
isAsync (line 204)

Returns the value of the async instance variable

  • access: public
boolean isAsync ()
setAsync (line 215)

Set the value of the async instance variable

  • access: public
void setAsync (boolean $isAsync)
  • boolean $isAsync
setCallbacks (line 239)

Set the value of the callback instance variable

  • access: public
void setCallbacks ( $callbacks, array $callback)
  • array $callback: An array of Javascript code fragments that are called during the lifecycle of the AJAX request. $callbacks['onSuccess'] = "alert('success!') $callbacks['onFailure'] = "alert('failure!')
  • $callbacks
setHTMLTarget (line 259)

Sets the value of the htmlid target instance variable

  • access: public
void setHTMLTarget (string $id)
  • string $id
setPosition (line 280)

Sets the value of the position target instance variable

  • access: public
void setPosition ( $position, string $id)
  • string $id
  • $position
setURL (line 194)

Sets the URL of the AJAX behavior

  • access: public
void setURL (string $url)
  • string $url
Class Constants
APPEND = 3 (line 57)
GET = "GET" (line 59)
POST = "POST" (line 58)
PREPEND = 2 (line 56)
REPLACE = 1 (line 55)

Documentation generated on Wed, 21 Feb 2007 12:03:20 -0800 by phpDocumentor 1.3.1