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

Class: HTML_QuickForm2_Element_Select

Source Location: /HTML_QuickForm2-0.1.0/QuickForm2/Element/Select.php

Class Overview

HTML_Common2
   |
   --HTML_QuickForm2_Node
      |
      --HTML_QuickForm2_Element
         |
         --HTML_QuickForm2_Element_Select

Class representing a <select> element


Author(s):

Version:

  • Release: 0.1.0

Variables

Methods


Inherited Variables

Inherited Methods

Class: HTML_QuickForm2_Element

HTML_QuickForm2_Element::getId()
HTML_QuickForm2_Element::getName()
HTML_QuickForm2_Element::getPersistentContent()
Generates hidden form field containing the element's value
HTML_QuickForm2_Element::onAttributeChange()
HTML_QuickForm2_Element::setId()
HTML_QuickForm2_Element::setName()
HTML_QuickForm2_Element::updateValue()
Called when the element needs to update its value from form's data sources

Class: HTML_QuickForm2_Node

HTML_QuickForm2_Node::__construct()
Class constructor
HTML_QuickForm2_Node::generateId()
Generates an id for the element
HTML_QuickForm2_Node::getContainer()
Returns the element containing current
HTML_QuickForm2_Node::getDataSources()
Returns the data sources for this element
HTML_QuickForm2_Node::getId()
Returns the element's id
HTML_QuickForm2_Node::getLabel()
Returns the element's label(s)
HTML_QuickForm2_Node::getName()
Returns the element's name
HTML_QuickForm2_Node::getType()
Returns the element's type
HTML_QuickForm2_Node::getValue()
Returns the element's value
HTML_QuickForm2_Node::persistentFreeze()
Changes the element's persistent freeze behaviour
HTML_QuickForm2_Node::setContainer()
Adds the link to the element containing current
HTML_QuickForm2_Node::setId()
Sets the elements id
HTML_QuickForm2_Node::setLabel()
Sets the element's label(s)
HTML_QuickForm2_Node::setName()
Sets the element's name
HTML_QuickForm2_Node::setValue()
Sets the element's value
HTML_QuickForm2_Node::storeId()
Stores the explicitly given id to prevent duplicate id generation
HTML_QuickForm2_Node::toggleFrozen()
Changes the element's frozen status
HTML_QuickForm2_Node::updateValue()
Called when the element needs to update its value from form's data sources

Class Details

[line 295]
Class representing a <select> element
  • Author: Bertrand Mansion <golgote@mamasam.com>
  • Author: Alexey Borzov <avb@php.net>
  • Version: Release: 0.1.0
  • Todo: Unit tests and better PHPDoc for loadOptions()


[ Top ]


Class Variables

$data = array('options' => null)

[line 304]

Contains options and data used for the element creation

  • options: Array of key-value pairs used for <option>s and <optgroup>s

  • Access: protected

Type:   array
Overrides:   Array


[ Top ]

$optionContainer =

[line 326]

Object containing options for the <select> element
  • Access: protected



[ Top ]

$persistent =  true

[line 297]

  • Access: protected

Type:   mixed
Overrides:   Array


[ Top ]

$possibleValues = array()

[line 319]

Possible values for select elements

A value is considered possible if it is present as a value attribute of some option and that option is not disabled.

  • Access: protected

Type:   array


[ Top ]

$values = array()

[line 310]

Values for the select element (i.e. values of the selected options)
  • Access: protected

Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 338]

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

Class constructor
  • Throws: HTML_QuickForm2_InvalidArgumentException if junk is given in $options
  • Access: public

Overrides HTML_QuickForm2_Node::__construct() (Class constructor)

Parameters:

string   $name   —  Element name
array   $data   —  Data used to populate the element's options, passed to loadOptions() method
mixed   $label   —  Label for the element (may be an array of labels)
mixed   $attributes   —  Attributes (either a string or an array)

[ Top ]

addOptgroup   [line 529]

HTML_QuickForm2_Element_Select_Optgroup addOptgroup( string $label, [mixed $attributes = null])

Adds a new optgroup
  • Access: public

Parameters:

string   $label   —  'label' attribute for optgroup tag
mixed   $attributes   —  Additional attributes for <optgroup> tag (either as a string or as an associative array)

[ Top ]

addOption   [line 516]

void addOption( string $text, string $value, [mixed $attributes = null])

Adds a new option

Please note that if you pass 'selected' attribute in the $attributes parameter then this option's value will be added to <select>'s values.

  • Access: public

Parameters:

string   $text   —  Option text
string   $value   —  'value' attribute for <option> tag
mixed   $attributes   —  Additional attributes for <option> tag (either as a string or as an associative array)

[ Top ]

getFrozenHtml   [line 369]

void getFrozenHtml( )

  • Access: protected

[ Top ]

getType   [line 344]

void getType( )

  • Access: public

Overrides HTML_QuickForm2_Node::getType() (Returns the element's type)
[ Top ]

getValue   [line 416]

mixed getValue( )

Returns the value of the <select> element

Please note that the returned value may not necessarily be equal to that passed to setValue(). It passes "intrinsic validation" confirming that such value could possibly be submitted by this <select> element. Specifically, this method will return null if the elements "disabled" attribute is set, it will not return values if there are no options having such a "value" attribute or if such options' "disabled" attribute is set. It will also only return a scalar value for single selects, mimicking the common browsers' behaviour.

  • Return: "value" attribute of selected option in case of single select, array of selected options' "value" attributes in case of multiple selects, null if no options selected
  • Access: public

Overrides HTML_QuickForm2_Node::getValue() (Returns the element's value)
[ Top ]

loadOptions   [line 464]

void loadOptions( array $options)

Loads <option>s (and <optgroup>s) for select element
  • Throws: HTML_QuickForm2_InvalidArgumentException if junk is given in $options
  • Access: public

Parameters:

array   $options   — 

[ Top ]

loadOptionsFromArray   [line 490]

void loadOptionsFromArray( HTML_QuickForm2_Element_Select_OptionContainer $container, array $options)

Adds options from given array into given container
  • Access: protected

Parameters:

HTML_QuickForm2_Element_Select_OptionContainer   $container   —  options will be added to this container
array   $options   —  options array

[ Top ]

setValue   [line 449]

void setValue( $value)

  • Access: public

Overrides HTML_QuickForm2_Node::setValue() (Sets the element's value)

Parameters:

   $value   — 

[ Top ]

updateValue   [line 534]

void updateValue( )

  • Access: protected

Overrides HTML_QuickForm2_Element::updateValue() (Called when the element needs to update its value from form's data sources)
[ Top ]

__toString   [line 349]

void __toString( )

  • Access: public

[ Top ]


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