HTML_QuickForm2
[ class tree: HTML_QuickForm2 ] [ index: HTML_QuickForm2 ] [ all elements ]

Class: HTML_QuickForm2_Node

Source Location: /HTML_QuickForm2-0.2.0/QuickForm2/Node.php

Class Overview

HTML_Common2
   |
   --HTML_QuickForm2_Node

Abstract base class for all QuickForm2 Elements and Containers


Author(s):

Version:

  • Release: 0.2.0

Variables

Methods


Child classes:

HTML_QuickForm2_Container
Abstract base class for simple QuickForm2 containers
HTML_QuickForm2_Element
Abstract base class for simple QuickForm2 elements (not Containers)

Inherited Variables

Inherited Methods


Class Details

[line 74]
Abstract base class for all QuickForm2 Elements and Containers

This class is mostly here to define the interface that should be implemented by the subclasses. It also contains static methods handling generation of unique ids for elements which do not have ids explicitly set.



[ Top ]


Class Variables

$container =  null

[line 98]

Element containing current
  • Access: protected



[ Top ]

$data =  null

[line 104]

Contains options and data used for the element creation
  • Access: protected

Type:   array


[ Top ]

$error =  null

[line 116]

Error message (usually set via Rule if validation fails)
  • Access: protected

Type:   string


[ Top ]

$frozen =  false

[line 86]

Element's "frozen" status
  • Access: protected

Type:   boolean


[ Top ]

$ids = array()

[line 80]

Array containing the parts of element ids
  • Access: protected

Type:   array


[ Top ]

$persistent =  false

[line 92]

Whether element's value should persist when element is frozen
  • Access: protected

Type:   boolean


[ Top ]

$rules = array()

[line 110]

Validation rules for element
  • Access: protected

Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 125]

HTML_QuickForm2_Node __construct( [string $name = null], [mixed $attributes = null], [array $data = array()])

Class constructor
  • Access: public

Overridden in child classes as:

HTML_QuickForm2::__construct()
Class constructor, form's "id" and "method" attributes can only be set here
HTML_QuickForm2_Element_Select::__construct()
Class constructor
HTML_QuickForm2_Element_InputFile::__construct()
Class constructor
HTML_QuickForm2_Element_InputCheckbox::__construct()

Parameters:

string   $name   —  Element name
mixed   $attributes   —  Attributes (either a string or an array)
array   $data   —  Element data (label, options and data used for element creation)

[ Top ]

addRule   [line 407]

HTML_QuickForm2_Rule addRule( HTML_QuickForm2_Rule|string $rule, [string $message = ''], [mixed $options = null])

Adds a validation rule
  • Return: The added rule
  • Throws: HTML_QuickForm2_NotFoundException if class for a given rule name cannot be found
  • Throws: HTML_QuickForm2_InvalidArgumentException if $rule is of a wrong type or rule name isn't registered with Factory
  • Access: public

Parameters:

HTML_QuickForm2_Rule|string   $rule   —  Validation rule or rule type
string   $message   —  Message to display if validation fails
mixed   $options   —  Additional data for the rule

[ Top ]

createRule   [line 444]

HTML_QuickForm2_Rule createRule( string $type, [string $message = ''], [mixed $options = null])

Creates a validation rule

This method is mostly useful when when chaining several rules together via HTML_QuickForm2_Rule::and_() and HTML_QuickForm2_Rule::or_() methods:

  1.  $first->addRule('nonempty''Fill in either first or second field')
  2.      ->or_($second->createRule('nonempty'));

  • Return: The created rule
  • Throws: HTML_QuickForm2_NotFoundException If class for the rule can't be found and/or loaded from file
  • Throws: HTML_QuickForm2_InvalidArgumentException If rule type is unknown
  • Access: public

Parameters:

string   $type   —  Rule type
string   $message   —  Message to display if validation fails
mixed   $options   —  Additional data for the rule

[ Top ]

generateId   [line 145]

string generateId( string $elementName)

Generates an id for the element

Called when an element is created without explicitly given id

  • Return: The generated element id
  • Access: protected

Parameters:

string   $elementName   —  Element name

[ Top ]

getContainer   [line 371]

HTML_QuickForm2_Container|null getContainer( )

Returns the element containing current
  • Access: public

[ Top ]

getDataSources   [line 381]

array getDataSources( )

Returns the data sources for this element
  • Access: protected

Overridden in child classes as:

HTML_QuickForm2::getDataSources()
Returns the list of data sources attached to the form

[ Top ]

getError   [line 499]

string getError( )

Returns the error message for the element
  • Access: public

[ Top ]

getId   [line 236]

string getId( )

Returns the element's id
  • Abstract:
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container::getId()
HTML_QuickForm2_Element::getId()

[ Top ]

getLabel   [line 274]

string|array getLabel( )

Returns the element's label(s)
  • Access: public

[ Top ]

getName   [line 219]

string getName( )

Returns the element's name
  • Abstract:
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container::getName()
HTML_QuickForm2_Container_Fieldset::getName()
HTML_QuickForm2_Element::getName()

[ Top ]

getType   [line 211]


getValue   [line 257]

mixed getValue( )

Returns the element's value
  • Abstract:
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container::getValue()
Returns the element's value
HTML_QuickForm2_Element_Textarea::getValue()
HTML_QuickForm2_Element_Select::getValue()
Returns the value of the <select> element
HTML_QuickForm2_Element_Input::getValue()
HTML_QuickForm2_Element_InputReset::getValue()
Reset elements cannot have any submit values
HTML_QuickForm2_Element_InputSubmit::getValue()
Returns the element's value
HTML_QuickForm2_Element_InputFile::getValue()
Returns the information on uploaded file
HTML_QuickForm2_Element_InputCheckable::getValue()
HTML_QuickForm2_Element_InputImage::getValue()
Returns the element's value
HTML_QuickForm2_Element_InputButton::getValue()
Button elements cannot have any submit values
HTML_QuickForm2_Element_Button::getValue()
Returns the element's value

[ Top ]

isRequired   [line 455]

boolean isRequired( )

Checks whether an element is required
  • Access: public

[ Top ]

persistentFreeze   [line 325]

bool persistentFreeze( [bool $persistent = null])

Changes the element's persistent freeze behaviour

If persistent freeze is on, the element's value will be kept (and submitted) in a hidden field when the element is frozen.

  • Return: Old value of "persistent freeze" flag
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container::persistentFreeze()

Parameters:

bool   $persistent   —  New value for "persistent freeze". If omitted, the method will not set anything, just return the current value of the flag.

[ Top ]

setContainer   [line 344]

void setContainer( [HTML_QuickForm2_Container $container = null])

Adds the link to the element containing current
  • Throws: HTML_QuickForm2_InvalidArgumentException If trying to set a child of an element as its container
  • Access: protected

Overridden in child classes as:

HTML_QuickForm2::setContainer()

Parameters:

HTML_QuickForm2_Container   $container   —  Element containing the current one, null if the link should really be removed (if removing from container)

[ Top ]

setError   [line 488]

HTML_QuickForm2_Node setError( [string $error = null])

Sets the error message to the element
  • Access: public

Parameters:

string   $error   — 

[ Top ]

setId   [line 249]

HTML_QuickForm2_Node setId( [string $id = null])

Sets the elements id

Please note that elements should always have an id in QuickForm2 and therefore it will not be possible to remove the element's id or set it to an empty value. If id is not explicitly given, it will be autogenerated.

  • Abstract:
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container::setId()
HTML_QuickForm2::setId()
HTML_QuickForm2_Element::setId()

Parameters:

string   $id   —  Element's id, will be autogenerated if not given

[ Top ]

setLabel   [line 289]

HTML_QuickForm2_Node setLabel( string|array $label)

Sets the element's label(s)
  • Access: public

Parameters:

string|array   $label   —  Label for the element (may be an array of labels)

[ Top ]

setName   [line 228]

HTML_QuickForm2_Node setName( string $name)

Sets the element's name
  • Abstract:
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container::setName()
HTML_QuickForm2_Container_Fieldset::setName()
HTML_QuickForm2_Element::setName()

Parameters:

string   $name   — 

[ Top ]

setValue   [line 266]

HTML_QuickForm2_Node setValue( mixed $value)

Sets the element's value
  • Abstract:
  • Access: public

Overridden in child classes as:

HTML_QuickForm2::setValue()
HTML_QuickForm2_Container_Fieldset::setValue()
HTML_QuickForm2_Element_Textarea::setValue()
HTML_QuickForm2_Element_Select::setValue()
HTML_QuickForm2_Element_Input::setValue()
HTML_QuickForm2_Element_InputReset::setValue()
Reset elements cannot have any submit values
HTML_QuickForm2_Element_InputSubmit::setValue()
Submit's value cannot be set via this method
HTML_QuickForm2_Element_InputFile::setValue()
File upload's value cannot be set here
HTML_QuickForm2_Element_InputCheckable::setValue()
HTML_QuickForm2_Element_InputImage::setValue()
Image button's value cannot be set via this method
HTML_QuickForm2_Element_InputButton::setValue()
Button elements cannot have any submit values
HTML_QuickForm2_Element_Button::setValue()
Button's value cannot be set via this method

Parameters:

mixed   $value   — 

[ Top ]

storeId   [line 191]

void storeId( string $id)

Stores the explicitly given id to prevent duplicate id generation
  • Access: protected

Parameters:

string   $id   —  Element id

[ Top ]

toggleFrozen   [line 304]

bool toggleFrozen( [bool $freeze = null])

Changes the element's frozen status
  • Return: Old value of element's frozen status
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container::toggleFrozen()
HTML_QuickForm2_Element_InputHidden::toggleFrozen()
Hidden elements can not be frozen
HTML_QuickForm2_Element_InputReset::toggleFrozen()
Reset buttons can not be frozen
HTML_QuickForm2_Element_InputSubmit::toggleFrozen()
Submit buttons can not be frozen
HTML_QuickForm2_Element_InputFile::toggleFrozen()
File upload elements cannot be frozen
HTML_QuickForm2_Element_InputImage::toggleFrozen()
Image buttons can not be frozen
HTML_QuickForm2_Element_InputButton::toggleFrozen()
Buttons can not be frozen
HTML_QuickForm2_Element_Button::toggleFrozen()
Buttons can not be frozen

Parameters:

bool   $freeze   —  Whether the element should be frozen or editable. If omitted, the method will not change the frozen status, just return its current value

[ Top ]

updateValue   [line 393]

void updateValue( )

Called when the element needs to update its value from form's data sources
  • Abstract:
  • Access: protected

Overridden in child classes as:

HTML_QuickForm2_Container::updateValue()
Called when the element needs to update its value from form's data sources
HTML_QuickForm2_Element::updateValue()
Called when the element needs to update its value from form's data sources
HTML_QuickForm2_Element_Select::updateValue()
HTML_QuickForm2_Element_InputSubmit::updateValue()
HTML_QuickForm2_Element_InputFile::updateValue()
HTML_QuickForm2_Element_InputCheckbox::updateValue()
HTML_QuickForm2_Element_InputImage::updateValue()
HTML_QuickForm2_Element_Button::updateValue()

[ Top ]

validate   [line 471]

boolean validate( )

Performs the server-side validation
  • Return: Whether the element is valid
  • Access: protected

Overridden in child classes as:

HTML_QuickForm2_Container::validate()
Performs the server-side validation
HTML_QuickForm2::validate()
Performs the server-side validation
HTML_QuickForm2_Element_InputFile::validate()
Performs the server-side validation

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:10:21 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.