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

Class: HTML_QuickForm_select

Source Location: /HTML_QuickForm-3.2.14/QuickForm/select.php

Class Overview

HTML_Common
   |
   --HTML_QuickForm_element
      |
      --HTML_QuickForm_select

Class to dynamically create an HTML SELECT


Author(s):

Version:

  • Release: 3.2.14

Methods


Child classes:

HTML_QuickForm_hiddenselect
Hidden select pseudo-element

Inherited Variables

Inherited Methods

Class: HTML_QuickForm_element

HTML_QuickForm_element::HTML_QuickForm_element()
Class constructor
HTML_QuickForm_element::accept()
Accepts a renderer
HTML_QuickForm_element::apiVersion()
Returns the current API version
HTML_QuickForm_element::exportValue()
Returns a 'safe' element's value
HTML_QuickForm_element::freeze()
Freeze the element so that only its value is returned
HTML_QuickForm_element::getFrozenHtml()
Returns the value of field without HTML tags
HTML_QuickForm_element::getLabel()
Returns display text for the element
HTML_QuickForm_element::getName()
Returns the element name
HTML_QuickForm_element::getType()
Returns element type
HTML_QuickForm_element::getValue()
Returns the value of the form element
HTML_QuickForm_element::isFrozen()
Returns whether or not the element is frozen
HTML_QuickForm_element::onQuickFormEvent()
Called by HTML_QuickForm whenever form event is made on this element
HTML_QuickForm_element::setLabel()
Sets display text for the element
HTML_QuickForm_element::setName()
Sets the input field name
HTML_QuickForm_element::setPersistantFreeze()
Sets wether an element value should be kept in an hidden field when the element is frozen or not
HTML_QuickForm_element::setValue()
Sets the value of the form element
HTML_QuickForm_element::unfreeze()
Unfreezes the element so that it becomes editable

Class Details

[line 42]
Class to dynamically create an HTML SELECT


[ Top ]


Method Detail

HTML_QuickForm_select (Constructor)   [line 78]

void HTML_QuickForm_select( [string $elementName = null], [mixed $elementLabel = null], [mixed $options = null], [mixed $attributes = null])

Class constructor
  • Since: 1.0
  • Access: public

Parameters:

string   $elementName   —  Select name attribute
mixed   $elementLabel   —  Label(s) for the select
mixed   $options   —  Data to be used to populate options
mixed   $attributes   —  Either a typical HTML attribute string or an associative array

[ Top ]

addOption   [line 302]

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

Adds a new OPTION to the SELECT
  • Since: 1.0
  • Access: public

Parameters:

string   $text   —  Display text for the OPTION
string   $value   —  Value for the OPTION
mixed   $attributes   —  Either a typical HTML attribute string or an associative array

[ Top ]

apiVersion   [line 98]

double apiVersion( )

Returns the current API version
  • Since: 1.0
  • Access: public

Overrides HTML_QuickForm_element::apiVersion() (Returns the current API version)
[ Top ]

exportValue   [line 560]

void exportValue( &$submitValues, [ $assoc = false])

We check the options and return only the values that _could_ have been

selected. We also return a scalar value if select is not "multiple"


Overrides HTML_QuickForm_element::exportValue() (Returns a 'safe' element's value)

Parameters:

   &$submitValues   — 
   $assoc   — 

[ Top ]

getFrozenHtml   [line 519]

string getFrozenHtml( )

Returns the value of field without HTML tags
  • Since: 1.0
  • Access: public

Overrides HTML_QuickForm_element::getFrozenHtml() (Returns the value of field without HTML tags)
[ Top ]

getMultiple   [line 283]

bool getMultiple( )

Returns the select mutiple attribute
  • Return: true if multiple select, false otherwise
  • Since: 1.2
  • Access: public

[ Top ]

getName   [line 167]

string getName( )

Returns the element name
  • Since: 1.0
  • Access: public

Overrides HTML_QuickForm_element::getName() (Returns the element name)
[ Top ]

getPrivateName   [line 182]

string getPrivateName( )

Returns the element name (possibly with brackets appended)
  • Since: 1.0
  • Access: public

[ Top ]

getSelected   [line 136]

array getSelected( )

Returns an array of the selected values
  • Return: of selected values
  • Since: 1.0
  • Access: public

[ Top ]

getSize   [line 248]

int getSize( )

Returns the select field size
  • Since: 1.0
  • Access: public

[ Top ]

getValue   [line 217]

array getValue( )

Returns an array of the selected values
  • Return: of selected values
  • Since: 1.0
  • Access: public

Overrides HTML_QuickForm_element::getValue() (Returns the value of the form element)
[ Top ]

load   [line 449]

PEAR_Error load( &$options, [mixed $param1 = null], [mixed $param2 = null], [mixed $param3 = null], [mixed $param4 = null], mixed $options)

Loads options from different types of data sources

This method is a simulated overloaded method. The arguments, other than the first are optional and only mean something depending on the type of the first argument. If the first argument is an array then all arguments are passed in order to loadArray. If the first argument is a db_result then all arguments are passed in order to loadDbResult. If the first argument is a string or a DB connection then all arguments are passed in order to loadQuery.

  • Return: on error or true
  • Since: 1.1
  • Throws: PEAR_Error
  • Access: public

Parameters:

mixed   $options   —  Options source currently supports assoc array or DB_result
mixed   $param1   —  (optional) See function detail
mixed   $param2   —  (optional) See function detail
mixed   $param3   —  (optional) See function detail
mixed   $param4   —  (optional) See function detail
   &$options   — 

[ Top ]

loadArray   [line 335]

PEAR_Error loadArray( array $arr, [mixed $values = null])

Loads the options from an associative array
  • Return: on error or true
  • Since: 1.0
  • Throws: PEAR_Error
  • Access: public

Parameters:

array   $arr   —  Associative array of options
mixed   $values   —  (optional) Array or comma delimited string of selected values

[ Top ]

loadDbResult   [line 367]

PEAR_Error loadDbResult( &$result, [string $textCol = null], [string $valueCol = null], [mixed $values = null], object $result)

Loads the options from DB_result object

If no column names are specified the first two columns of the result are used as the text and value columns respectively

  • Return: on error or true
  • Since: 1.0
  • Throws: PEAR_Error
  • Access: public

Parameters:

object   $result   —  DB_result object
string   $textCol   —  (optional) Name of column to display as the OPTION text
string   $valueCol   —  (optional) Name of column to use as the OPTION value
mixed   $values   —  (optional) Array or comma delimited string of selected values
   &$result   — 

[ Top ]

loadQuery   [line 402]

void loadQuery( &$conn, string $sql, [string $textCol = null], [string $valueCol = null], [mixed $values = null], mixed $conn)

Queries a database and loads the options from the results
  • Since: 1.1
  • Throws: PEAR_Error
  • Access: public

Parameters:

mixed   $conn   —  Either an existing DB connection or a valid dsn
string   $sql   —  SQL query string
string   $textCol   —  (optional) Name of column to display as the OPTION text
string   $valueCol   —  (optional) Name of column to use as the OPTION value
mixed   $values   —  (optional) Array or comma delimited string of selected values
   &$conn   — 

[ Top ]

onQuickFormEvent   [line 591]

void onQuickFormEvent( $event, $arg, &$caller)


Overrides HTML_QuickForm_element::onQuickFormEvent() (Called by HTML_QuickForm whenever form event is made on this element)

Parameters:

   $event   — 
   $arg   — 
   &$caller   — 

[ Top ]

setMultiple   [line 264]

void setMultiple( bool $multiple)

Sets the select mutiple attribute
  • Since: 1.2
  • Access: public

Parameters:

bool   $multiple   —  Whether the select supports multi-selections

[ Top ]

setName   [line 152]

void setName( string $name)

Sets the input field name
  • Since: 1.0
  • Access: public

Overrides HTML_QuickForm_element::setName() (Sets the input field name)

Parameters:

string   $name   —  Input field name attribute

[ Top ]

setSelected   [line 114]

void setSelected( mixed $values)

Sets the default values of the select box
  • Since: 1.0
  • Access: public

Parameters:

mixed   $values   —  Array or comma delimited string of selected values

[ Top ]

setSize   [line 233]

void setSize( int $size)

Sets the select field size, only applies to 'multiple' selects
  • Since: 1.0
  • Access: public

Parameters:

int   $size   —  Size of select field

[ Top ]

setValue   [line 202]

void setValue( $value, mixed $values)

Sets the value of the form element
  • Since: 1.0
  • Access: public

Overrides HTML_QuickForm_element::setValue() (Sets the value of the form element)

Parameters:

mixed   $values   —  Array or comma delimited string of selected values
   $value   — 

[ Top ]

toHtml   [line 474]

string toHtml( )

Returns the SELECT in HTML
  • Since: 1.0
  • Access: public

Overridden in child classes as:

HTML_QuickForm_hiddenselect::toHtml()
Returns the SELECT in HTML

[ Top ]


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