Class constructor. Simply initialize the instance variables to the variables passed
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
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.
ZFormElementBehavior procotol method which emits the javascript necessary to apply the AJAX behavior to the element
Returns the value of the callbacks instance variable
boolean
getCallbacks
()
Returns the value of the htmlid instance variable
string
getHTMLTarget
()
Returns the value of the position instance variable
string
getPosition
()
Returns the URL of the AJAX behavior
string
getURL
()
Returns the value of the async instance variable
boolean
isAsync
()
Set the value of the async instance variable
void
setAsync
(boolean $isAsync)
Set the value of the callback instance variable
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
Sets the value of the htmlid target instance variable
void
setHTMLTarget
(string $id)
Sets the value of the position target instance variable
void
setPosition
( $position, string $id)
Sets the URL of the AJAX behavior
void
setURL
(string $url)