Select with label and help link.

This is used to build HTML code by using objects.

package | metaHTML

### Methods

## Constructor.

    __construct(String $name, array $elements, array $selectedElements, String $label, String $helpID, int $size)

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);

### Parameters

#### $name

`String`

element name

#### $elements

`array`

list of elememts

#### $selectedElements

`array`

list of selected elements

#### $label

`String`

descriptive label

#### $helpID

`String`

help ID (optional, default none)

#### $size

`int`

size (optional, default = 1)

## Prints the HTML code for this element.

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

### Parameters

#### $module

`string`

Name of account module

#### $input

`array`

List of meta-HTML elements

#### $values

`array`

List of values which override the defaults in $input (name => value)

#### $restricted

`boolean`

If true then no buttons will be displayed

#### $tabindex

`integer`

Start value of tabulator index for input fields

#### $scope

`string`

Account type

### Returns

`array`List of input field names and their type (name => type)

## Returns the HTML attributes for the alignment.

    getAlignmentString() : String

Inherited

inherited_from | \htmlElement::getAlignmentString()
inherited_from | \htmlSelect::getAlignmentString()

### Returns

`String`alignment HTML attributes (e.g. align="right" valign="top")

## Returns the HTML attribute for the colspan.

    getColspanString() : String

Inherited

inherited_from | \htmlElement::getColspanString()
inherited_from | \htmlSelect::getColspanString()

### Returns

`String`colspan HTML attribute (e.g. colspan=3)

## Returns the HTML attribute for the rowspan.

    getRowspanString() : String

Inherited

inherited_from | \htmlElement::getRowspanString()
inherited_from | \htmlSelect::getRowspanString()

### Returns

`String`rowspan HTML attribute (e.g. rowspan=3)

## Returns the CSS classes of the surrounding table cell for this element.

    getTableCellCSSClasses() : array

Inherited

inherited_from | \htmlElement::getTableCellCSSClasses()
inherited_from | \htmlSelect::getTableCellCSSClasses()

### Returns

`array`CSS classes

## Adds CSS classes to this element.

    setCSSClasses(array $classes)

Inherited

inherited_from | \htmlElement::setCSSClasses()
inherited_from | \htmlSelect::setCSSClasses()

### Parameters

#### $classes

`array`

CSS class names

## Specifies if the elements are divided into optgroups.

    setContainsOptgroups(boolean $containsOptgroups)

Inherited

inherited_from | \htmlSelect::setContainsOptgroups()

### Parameters

#### $containsOptgroups

`boolean`

activates optgroups

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

    setHasDescriptiveElements(boolean $hasDescriptiveElements)

Inherited

inherited_from | \htmlSelect::setHasDescriptiveElements()

### Parameters

#### $hasDescriptiveElements

`boolean`

activates descriptive elements

## Specifies if this component is enabled and accepts user modification.

    setIsEnabled(boolean $isEnabled)

Inherited

inherited_from | \htmlSelect::setIsEnabled()

### Parameters

#### $isEnabled

`boolean`

enabled if true

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

    setMultiSelect(boolean $multiSelect)

Inherited

inherited_from | \htmlSelect::setMultiSelect()

### Parameters

#### $multiSelect

`boolean`

allows multi-selection

## Sets the JavaScript code for the onchange event.

    setOnchangeEvent(String $onchangeEvent)

Inherited

inherited_from | \htmlSelect::setOnchangeEvent()

### Parameters

#### $onchangeEvent

`String`

onchange event code (e.g. myfunction();)

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

    setRightToLeftTextDirection(boolean $rightToLeftTextDirection)

Inherited

inherited_from | \htmlSelect::setRightToLeftTextDirection()

### Parameters

#### $rightToLeftTextDirection

`boolean`

if true use right to left direction

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

    setSortElements(boolean $sortElements)

Inherited

inherited_from | \htmlSelect::setSortElements()

### Parameters

#### $sortElements

`boolean`

sort elements

## Adds CSS classes to the surrounding table cell for this element.

    setTableCellCSSClasses(array $classes)

Inherited

inherited_from | \htmlElement::setTableCellCSSClasses()
inherited_from | \htmlSelect::setTableCellCSSClasses()

### Parameters

#### $classes

`array`

CSS class names

## This will hide the given table rows when the select is changed to the specified value.

    setTableRowsToHide(array $tableRowsToHide)

Inherited

The given IDs can be of any e.g. input element. Starting from this element the first parent "

" element will be used to show/hide.
Example:
Using "mycheckbox" will use this "tr" to hide/show.
Example for $tableRowsToHide:
array('yes' => array('option1', 'option2'), 'no' => array('option3'))

inherited_from | \htmlSelect::setTableRowsToHide()

### Parameters

#### $tableRowsToHide

`array`

array of select value => array of IDs of child elements to hide

## This will show the given table rows when the select is changed to the specified value.

    setTableRowsToShow(array $tableRowsToShow)

Inherited

The given IDs can be of any e.g. input element. Starting from this element the first parent "

" element will be used to show/hide.
Example:
Using "mycheckbox" will use this "tr" to hide/show.
Example for $tableRowsToShow:
array('yes' => array('option1', 'option2'), 'no' => array('option3'))

inherited_from | \htmlSelect::setTableRowsToShow()

### Parameters

#### $tableRowsToShow

`array`

array of select value => array of IDs of child elements to show

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

    setTransformSingleSelect(boolean $transformSingleSelect)

Inherited

inherited_from | \htmlSelect::setTransformSingleSelect()

### Parameters

#### $transformSingleSelect

`boolean`

transform single options to text

## Specifies that the value should not be automatically saved when used in self service or server profile (default: false).

    setTransient(boolean $transient)

Inherited

inherited_from | \htmlSelect::setTransient()

### Parameters

#### $transient

`boolean`

transient field

## Specifies the width of this selection box.

    setWidth(String $width)

Inherited

inherited_from | \htmlSelect::setWidth()

### Parameters

#### $width

`String`

width (e.g. 20em)

## Creates the JavaScript code to hide/show table rows based on the select value.

    printCodeForShowHideTableRows(String $onChange)

Inherited

inherited_from | \htmlSelect::printCodeForShowHideTableRows()

### Parameters

#### $onChange

`String`

onChange code

## Prints the HTML code of the option tags.

    printOptionsHTML(array $elements)

Inherited

inherited_from | \htmlSelect::printOptionsHTML()

### Parameters

#### $elements

`array`

list of options

### Properties

## alignment when inside a table

    $alignment

Inherited

inherited_from | \htmlElement::$$alignment
inherited_from | \htmlSelect::$$alignment

## colspan if inside a table

    $colspan

Inherited

inherited_from | \htmlElement::$$colspan
inherited_from | \htmlSelect::$$colspan

## rowspan if inside a table

    $rowspan

Inherited

inherited_from | \htmlElement::$$rowspan
inherited_from | \htmlSelect::$$rowspan

## CSS classes

    $cssClasses

Inherited

inherited_from | \htmlElement::$$cssClasses
inherited_from | \htmlSelect::$$cssClasses

## table cell CSS classes

    $tableCellCssClasses

Inherited

inherited_from | \htmlElement::$$tableCellCssClasses
inherited_from | \htmlSelect::$$tableCellCssClasses

## list of enclosing table rows to hide when checked

    $tableRowsToHide

Inherited

inherited_from | \htmlSelect::$$tableRowsToHide

## list of enclosing table rows to show when checked

    $tableRowsToShow

Inherited

inherited_from | \htmlSelect::$$tableRowsToShow

## contains optgroups

    $containsOptgroups

Inherited

inherited_from | \htmlSelect::$$containsOptgroups

## elements

    $elements

Inherited

inherited_from | \htmlSelect::$$elements

## descriptive elements

    $hasDescriptiveElements

Inherited

inherited_from | \htmlSelect::$$hasDescriptiveElements

## help ID

    $helpID

## enabled or disabled

    $isEnabled

Inherited

inherited_from | \htmlSelect::$$isEnabled

## descriptive label

    $label

## allows multi-selection

    $multiSelect

Inherited

inherited_from | \htmlSelect::$$multiSelect

## name of select field

    $name

Inherited

inherited_from | \htmlSelect::$$name

## onchange event

    $onchangeEvent

Inherited

inherited_from | \htmlSelect::$$onchangeEvent

## right to left text direction

    $rightToLeftTextDirection

Inherited

inherited_from | \htmlSelect::$$rightToLeftTextDirection

## selected elements

    $selectedElements

Inherited

inherited_from | \htmlSelect::$$selectedElements

## size

    $size

Inherited

inherited_from | \htmlSelect::$$size

## sorting enabled

    $sortElements

Inherited

inherited_from | \htmlSelect::$$sortElements

## transform select boxes with one element to text

    $transformSingleSelect

Inherited

inherited_from | \htmlSelect::$$transformSingleSelect

## indicates that this field should not automatically be saved in the self service or server profile

    $transient

Inherited

inherited_from | \htmlSelect::$$transient

## width of input element

    $width

Inherited

inherited_from | \htmlSelect::$$width

### Constants

## align to bottom

    ALIGN_BOTTOM

Inherited

inherited_from | \htmlElement::ALIGN_BOTTOM
inherited_from | \htmlSelect::ALIGN_BOTTOM

## align to center

    ALIGN_CENTER

Inherited

inherited_from | \htmlElement::ALIGN_CENTER
inherited_from | \htmlSelect::ALIGN_CENTER

## align to left

    ALIGN_LEFT

Inherited

inherited_from | \htmlElement::ALIGN_LEFT
inherited_from | \htmlSelect::ALIGN_LEFT

## align to right

    ALIGN_RIGHT

Inherited

inherited_from | \htmlElement::ALIGN_RIGHT
inherited_from | \htmlSelect::ALIGN_RIGHT

## align to top

    ALIGN_TOP

Inherited

inherited_from | \htmlElement::ALIGN_TOP
inherited_from | \htmlSelect::ALIGN_TOP

## validation rule to allow only numbers ([0-9]+)

    VALIDATE_NUMERIC

Inherited

inherited_from | \htmlElement::VALIDATE_NUMERIC
inherited_from | \htmlSelect::VALIDATE_NUMERIC