## ZFormWebElement

Description

- license: Zend Framework License version 1.0
- copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Form/elements/ZFormWebElement.php (line 34)

    ZFormElement
       |
       --ZFormWebElement

Direct descendents

Class | Description
--- | ---
ZForm |
ZFormInputElement |
ZFormLink |
ZFormOption |
ZFormSelect |

Variable Summary
mixed $_bottomBlocks
mixed $_tagName
mixed $_topBlocks
mixed $_wrapExisting
Method Summary
ZFormWebElement __construct ([ $id = null], [ $parentNode = null], [ $tagName = null], [ $wrapExisting = false])
void addScriptBlock (string $script, [string $name = null], [boolean $top = true])
void close ([ $renderScriptBlock = true])
void emitAttributes ()
void emitScriptBlocks ([boolean $top = true])
mixed getMemento ()
string getValue ()
void loadRequestData ()
void open ([ $renderScriptBlock = true])
void render ([boolean $renderScriptBlock = true])
void renderBody ([boolean $renderScriptBlock = false])
void setMemento ( $memento)
void setValue (string $value)
void setWrapExisting (boolean $wrapExisting)
void _applyClientBehaviors ()
void _emitClientBehaviors ()
void _emitClientValidators ()
string __get (string $nm)
void __set (string $nm, string $val)
Variables
mixed $_bottomBlocks (line 38)

- access: protected

mixed $_tagName (line 36)

- access: protected

mixed $_topBlocks (line 37)

- access: protected

mixed $_wrapExisting (line 39)

- access: protected

#### Inherited Variables

Inherited from ZFormElement

> ZFormElement::$_attributes
> ZFormElement::$_behaviors
> ZFormElement::$_childNodes
> ZFormElement::$_eatEvents
> ZFormElement::$_errors
> ZFormElement::$_eventListeners
> ZFormElement::$_events
> ZFormElement::$_idPath
> ZFormElement::$_parentNode
> ZFormElement::$_process
> ZFormElement::$_validators

Methods
Constructor __construct (line 45)

- access: public
- todo: docblock

ZFormWebElement __construct ([ $id = null], [ $parentNode = null], [ $tagName = null], [ $wrapExisting = false])

- $id
- $parentNode
- $tagName
- $wrapExisting

Redefinition of:

ZFormElement::__construct()
  Class constructor. Initializes internal instance variables. $id is

Redefined in descendants as:

- ZForm::__construct() : Class constructor. Sets up the ZForm element, types it a a 'FORM' element
- ZFormInputElement::__construct() : Class constructor. Sets up the ZForm element, types it as a 'INPUT' element.
- ZFormButton::__construct() : Class constructor. Sets up the ZForm element, types it as a 'FORM' element
- ZFormCheckbox::__construct() : Class constructor. Sets up the ZForm element, types it as a 'CHECKBOX' element
- ZFormEntryField::__construct() : Class constructor. Sets up the ZForm element, types it as a 'TEXT' element
- ZFormFile::__construct() : Class constructor. Sets up the ZForm element, types it as a 'FILE' element
- ZFormHiddenField::__construct() : Class constructor. Sets up the ZForm element, types it as a 'HIDDEN' element
- ZFormImage::__construct() : Class constructor. Sets up the ZForm element, types it as a 'IMAGE' element
- ZFormPasswordField::__construct() : Class constructor. Sets up the ZForm element, types it as a 'PASSWORD' element.
- ZFormRadioButton::__construct() : Class constructor. Sets up the ZForm element, types it as a 'RADIO' element.
- ZFormResetButton::__construct() : Class constructor. Sets up the ZForm element, types it as a 'RESET' element.
- ZFormSubmitButton::__construct() : Class constructor. Sets up the ZForm element, types it as a 'SUBMIT' element.
- ZFormLink::__construct() : Class constructor.
- ZFormOption::__construct() : Class constructor. Sets up the ZForm element, types it as a 'OPTION' element.
- ZFormSelect::__construct() : Class constructor. Sets up the ZForm element, types it as a 'SELECT' element.

addScriptBlock (line 266)

Adds a fragment of script (optionally) named to the element either at the top or bottom of the element. Named script blocks are maintained in an assoc array.

- access: public

void addScriptBlock (string $script, [string $name = null], [boolean $top = true])

- string $script: JavaScript fragment
- string $name: option name of the script fragment
- boolean $top: true (default) add the fragment to the top of the element otherwise at the bottom

close (line 194)

Generates the closing stanza for the HTML which consists of closing tag.

Nothing is generated if the element is wrapping existing markup.

- access: public

void close ([ $renderScriptBlock = true])

- $renderScriptBlock

emitAttributes (line 128)

Generates the attributes of the ZFormWebElement HTML opening stanza. Values are double quoted in the output stream.

- access: public

void emitAttributes ()
emitScriptBlocks (line 295)

Iterates over the script fragments associated with the elements and emits them into the current output stream.

- access: public

void emitScriptBlocks ([boolean $top = true])

- boolean $top: true (default) emit the top script fragment, otherwise the bottom fragments are emitted.

getMemento (line 344)

Default implementation of retriving the memento associated with the element

that will be used during persistent (@see persist()) The default implementation does not persist anything, we implement it here so subclasses are not required to

- return: null for the default implementation, subclasses should override.
- access: public

mixed getMemento ()

Redefinition of:

ZFormElement::getMemento()
  Default implementation of retriving the memento associated with the element

Redefined in descendants as:

- ZFormInputElement::getMemento() : Retrieve the memento which will be stored with the session data representing the state of the input field. The default implemention is to simply ask the input element for its value
- ZFormCheckbox::getMemento() : Create a memento which saves the state of the Checkbox for storage in the session.
- ZFormImage::getMemento() : Create a memento which saves the state of the FormImage for storage in the session.
- ZFormRadioButton::getMemento() : Default implementation of retriving the memento associated with the element
- ZFormLink::getMemento() : Returns the memento used to persist the state of the link, which is simply the text.

getValue (line 86)

Overridden implementation of getValue which returns the 'value' attribute of the ZFormWebElement

- access: public

string getValue ()

Redefinition of:

ZFormElement::getValue()
  Abstract method used to retrive the value associated with the

loadRequestData (line 317)

Retrieves the data associated with this element from the ZRequest object.

- access: public
- todo: I don't like getting from both get and post, Options include getting parent until a form is identified Potentially pass bucket in as well I don't like searching up, because for other controls you may not be contained withing a form

void loadRequestData ()

Redefinition of:

ZFormElement::loadRequestData()
  Abstract implementation that interates of the children of the element invoking loadRequestData. During this phase of the processing cycle elements should retrieve input data from the ZRequest object

Redefined in descendants as:

- ZFormCheckbox::loadRequestData() : The method is called when a ZForm is being processed to give the ZFormCheckbox and opportunity to initialize itself even when there is not data being directly targed to the ZFormWebElement
- ZFormImage::loadRequestData() : The methods will loaded the x & y position of the image click into the ZFormImage component.
- ZFormRadioButton::loadRequestData() : Retrieves the data associated with this element from the ZRequest object.
- ZFormSelect::loadRequestData() : Abstract implementation that interates of the children of the element invoking loadRequestData. During this phase of the processing cycle elements should retrieve input data from the ZRequest object

open (line 171)

Generates the opening stanza of the HTML which consists of the opening tags and the attributes of the element. If the element does not contain children the tag is also closed. Nothing is generated if the tag is wrapping existing markup.

- access: public

void open ([ $renderScriptBlock = true])

- $renderScriptBlock

render (line 226)

Renders the ZFormWebElement into its HTML into the current output

stream. Rendering the element consists of 1) Opening the tag 2) Rendering its body 3) Closing the tag 4) Emitting validators and behaviors associated with the element

- access: public

void render ([boolean $renderScriptBlock = true])

- boolean $renderScriptBlock: optional parameter used to instruct the element to also render it javascript block that go before and after the element

renderBody (line 243)

Renders the body of the element's which by default consists of

rendering each of the element's children. Subclasses should implement this methods to perform and specific tasks and then send super for processing the children

- access: public

void renderBody ([boolean $renderScriptBlock = false])

- boolean $renderScriptBlock: Determines of javascript blocks are emitted, true = script is emitted, false they are not

Redefined in descendants as:

- ZFormLink::renderBody() : Renders the text content of the link.
- ZFormOption::renderBody() : Render the body of the ZFormOptions which is the $text property of the ZFormOption object

setMemento (line 354)

The bookend implementation to @see getMemento(). This function is a void

implementation of the protocol to simplify the task of subclassing

- access: public

void setMemento ( $memento)

- $memento

Redefinition of:

ZFormElement::setMemento()
  The bookend implementation to @see getMemento(). This function is a void

Redefined in descendants as:

- ZFormInputElement::setMemento() : Restores the state of the input element from its memento which was returned by getMemento above. The default implementation is to set the value of the input element to the memento.
- ZFormCheckbox::setMemento() : Restores the state of the checkbox from its memento which was returned by getMemento.
- ZFormImage::setMemento() : Restores the state of the ZFormImage from its memento which was returned by getMemento.
- ZFormRadioButton::setMemento() : The bookend implementation to @see getMemento(). This function is a void
- ZFormLink::setMemento() : Retores the state of the link from its memento

setValue (line 99)

Overridden implementation of setValue which sets the 'value' of the attribute for the ZFormWebElement

- access: public

void setValue (string $value)

- string $value

Redefinition of:

ZFormElement::setValue()
  Implementation of the setValue which ONLY generates a ONVALUECHANGE event if the new $value is different from the current value. This means the subclasses MUST call this implementation and store the value.

Redefined in descendants as:

- ZFormCheckbox::setValue() : Overrides setValue in the parent to also set the checked status of the ZCheckBox.
- ZFormRadioButton::setValue() : Overridden implementation of setValue which sets the 'value' of the attribute for the ZFormWebElement

setWrapExisting (line 117)

ZFormWebElements can be used to wraped existing HTML forms so that

validators and behaviors can be added to the page witout changing the original form definition. The setWrapExisting method tells the ZFormWebElement that to operate in this mode. NOTE: When wrapping existing forms, ZFormWebElements do not generate HTML markup

- access: public

void setWrapExisting (boolean $wrapExisting)

- boolean $wrapExisting: true means to wrap existing markup, false otherwise

_applyClientBehaviors (line 409)

This method enables the behaviors associated with element to have a chance to modified the element before it is emitted.

- access: protected

void _applyClientBehaviors ()
_emitClientBehaviors (line 387)

Generates the behaviors associated with the element. Validators are guaranteed to run with the JavaScript variable 'element' bound to the HTML presentation of the form element.

- access: protected

void _emitClientBehaviors ()
_emitClientValidators (line 364)

Generates the validators associated with the element.

- access: protected

void _emitClientValidators ()
__get (line 61)

ZFormWebElements maintain HTML attributes using the __get method.

- access: public

string __get (string $nm)

- string $nm: The name of the HTML attribute to retrieve

__set (line 73)

Sets the value of the $nm HTML property on the ZFormWebElement.

- access: public

void __set (string $nm, string $val)

- string $nm: Name of the HTML element to set
- string $val: Value of the attribute

#### Inherited Methods

Inherited From ZFormElement

> ZFormElement::__construct()
> ZFormElement::addBehavior()
> ZFormElement::addEventListener()
> ZFormElement::addValidator()
> ZFormElement::appendChild()
> ZFormElement::fireEvent()
> ZFormElement::getAttribute()
> ZFormElement::getAttributes()
> ZFormElement::getBehaviors()
> ZFormElement::getChildNodes()
> ZFormElement::getElementById()
> ZFormElement::getErrorMessage()
> ZFormElement::getEventListeners()
> ZFormElement::getID()
> ZFormElement::getIDPath()
> ZFormElement::getIsProcessing()
> ZFormElement::getMemento()
> ZFormElement::getParentNode()
> ZFormElement::getRoot()
> ZFormElement::getValidationErrors()
> ZFormElement::getValidators()
> ZFormElement::getValue()
> ZFormElement::handleEvent()
> ZFormElement::hasChildNodes()
> ZFormElement::invokeApplication()
> ZFormElement::loadRequestData()
> ZFormElement::persist()
> ZFormElement::process()
> ZFormElement::removeChild()
> ZFormElement::removedBehavior()
> ZFormElement::removedValidator()
> ZFormElement::removeEventListener()
> ZFormElement::restoreState()
> ZFormElement::setAllowEvents()
> ZFormElement::setAttribute()
> ZFormElement::setID()
> ZFormElement::setMemento()
> ZFormElement::setParentNode()
> ZFormElement::setProcess()
> ZFormElement::setValue()
> ZFormElement::validate()
> ZFormElement::_appendToList()
> ZFormElement::_computeIDPath()
> ZFormElement::_gatherMementos()
> ZFormElement::_isLegalName()
> ZFormElement::_performValidation()
> ZFormElement::_processEvents()
> ZFormElement::_removeFromList()
> ZFormElement::_restoreMementos()

Class Constants

#### Inherited Constants

Inherited from ZFormElement

> ZFormElement::PATH_SEPARATOR

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