metaHTML

# Class: htmlSelect

Source Location: /lib/html.inc

### Class Overview

    htmlElement
       |
       --htmlSelect

Represents a select box.

### Methods

- __construct
- generateHTML
- setContainsOptgroups
- setHasDescriptiveElements
- setIsEnabled
- setMultiSelect
- setOnchangeEvent
- setRightToLeftTextDirection
- setSortElements
- setTransformSingleSelect
- setWidth

### Child classes:

htmlTableExtendedSelect
  Select with label and help link.

### Inherited Constants

#### Class: htmlElement

htmlElement::ALIGN_BOTTOM
htmlElement::ALIGN_CENTER
htmlElement::ALIGN_LEFT
htmlElement::ALIGN_RIGHT
htmlElement::ALIGN_TOP
htmlElement::VALIDATE_NUMERIC

### Inherited Variables

#### Class: htmlElement

htmlElement::$alignment
htmlElement::$colspan
htmlElement::$rowspan

### Inherited Methods

#### Class: htmlElement

htmlElement::generateHTML()
  Prints the HTML code for this element.
htmlElement::getAlignmentString()
  Returns the HTML attributes for the alignment.
htmlElement::getColspanString()
  Returns the HTML attribute for the colspan.
htmlElement::getRowspanString()
  Returns the HTML attribute for the rowspan.

### Class Details

[line 773]
Represents a select box.
[ Top ]

### Class Methods

### constructor __construct [line 821]

`htmlSelect __construct( String $name, array $elements, [array $selectedElements = array()], [int $size = 1])`

Constructor.

Examples:
$select = new htmlSelect('myName', array('value1', 'value2'), array('value1'));
$select = new htmlSelect('myName', array('label1' => 'value1', 'label2' => 'value2'), array('value1'));
$select->setHasDescriptiveElements(true);
$select = new htmlSelect('myName', array('optgroupLabel' => array('value1', 'value2')), array('value1'));
$select->setHasDescriptiveElements(true);
$select->setContainsOptgroups(true);

Overridden in child classes as:

htmlTableExtendedSelect::__construct()
  Constructor.

#### Parameters:

String | $name | element name
array | $elements | list of elements array(label => value) or array(value1, value2) or array('optgroup' => array(...))
array | $selectedElements | list of selected elements (optional, default none)
int | $size | size (optional, default = 1)

[ Top ]

### method generateHTML [line 841]

`array generateHTML( string $module, array $input, array $values, boolean $restricted, &$tabindex, string $scope, integer $tabindex)`

Prints the HTML code for this element.

#### Tags:

return: | List of input field names and their type (name => type)

Overridden in child classes as:

htmlTableExtendedSelect::generateHTML()
  Prints the HTML code for this element.

Overrides htmlElement::generateHTML() (Prints the HTML code for this element.)

#### Parameters:

string | $module | Name of account module
array | $input | List of meta-HTML elements
array | $values | List of values which override the defaults in $input (name => value)
boolean | $restricted | If true then no buttons will be displayed
integer | $tabindex | Start value of tabulator index for input fields
string | $scope | Account type
| &$tabindex |

[ Top ]

### method setContainsOptgroups [line 962]

`void setContainsOptgroups( boolean $containsOptgroups)`

Specifies if the elements are divided into optgroups.

#### Tags:

access: | public

#### Parameters:

boolean | $containsOptgroups | activates optgroups

[ Top ]

### method setHasDescriptiveElements [line 953]

`void setHasDescriptiveElements( boolean $hasDescriptiveElements)`

Specifies if the elements are just a simple list or an assoziative array (default: simple list).

#### Tags:

access: | public

#### Parameters:

boolean | $hasDescriptiveElements | activates descriptive elements

[ Top ]

### method setIsEnabled [line 998]

`void setIsEnabled( boolean $isEnabled)`

Specifies if this component is enabled and accepts user modification.

#### Tags:

access: | public

#### Parameters:

boolean | $isEnabled | enabled if true

[ Top ]

### method setMultiSelect [line 971]

`void setMultiSelect( boolean $multiSelect)`

Specifies if multi-selection is enabled (default: disabled).

#### Tags:

access: | public

#### Parameters:

boolean | $multiSelect | allows multi-selection

[ Top ]

### method setOnchangeEvent [line 1025]

`void setOnchangeEvent( String $onchangeEvent)`

Sets the JavaScript code for the onchange event.

#### Tags:

access: | public

#### Parameters:

String | $onchangeEvent | onchange event code (e.g. myfunction();)

[ Top ]

### method setRightToLeftTextDirection [line 989]

`void setRightToLeftTextDirection( boolean $rightToLeftTextDirection)`

Specifies if the text direction should be set to right to left.

#### Tags:

access: | public

#### Parameters:

boolean | $rightToLeftTextDirection | if true use right to left direction

[ Top ]

### method setSortElements [line 980]

`void setSortElements( boolean $sortElements)`

Specifies if the elemets should be sorted (default: sort).

#### Tags:

access: | public

#### Parameters:

boolean | $sortElements | sort elements

[ Top ]

### method setTransformSingleSelect [line 1016]

`void setTransformSingleSelect( boolean $transformSingleSelect)`

Specifies if select boxes that contain only a single element should be transformed to a simple text field.

#### Tags:

access: | public

#### Parameters:

boolean | $transformSingleSelect | transform single options to text

[ Top ]

### method setWidth [line 1007]

`void setWidth( String $width)`

Specifies the width of this selection box.

#### Tags:

access: | public

#### Parameters:

String | $width | width (e.g. 20em)

[ Top ]

Documentation generated on Tue, 22 Nov 2011 16:29:49 +0100 by phpDocumentor 1.4.1