DomTemplate


Dom_FormSelect

Class Dom_FormSelect

Dom_FormElement
|
+--Dom_FormSelect

public class Dom_FormSelect
extends Dom_FormElement

A class that handle a forms select element.


Fields inherited from Dom_FormElement
element, form
Method Summary
DOMElement

appendOptGroup(mixed label, string optGroup, string The)

Append an 'OptGroup' to the base node or the optGroup

DOMElement

appendOption(mixed text, mixed value, string optGroup, string The)

Append an 'Option' to this 'Select' objectIf no value is supplied the text parameter is used as the value.

void

clearSelected()

Clear all selected elements

private DOMElement

clearSelectedFunction(DOMElement node, string name)

Find the opt group node with the name

void

enableMultiple(boolean b)

Set the select list to handle multiple selections NOTE: When multiple is dissabled and multiple elements are selected it behaviour is unknown and browser specific.

DOMElement

findOptGroup(DOMElement node, string name)

Find the opt group node with the name

DOMElement

findOption(DOMElement node, string value)

Find an option node

array

findSelected(DOMElement node)

Find the selected values to this select box

mixed

getValue()

Return the selected value, Will return an array if multiple select is enabled.

boolean

isMultiple()

Return if this is a multiple select or not.

boolean

optGroupExists(string name)

Check if the opt group exists

void

removeOptions()

Clear this 'select' element of all its 'option' elements.

void

setValue(string value)

Set the selected value of the form element

void

useTextNodes(boolean b)

Use Text Nodes, Set to True by default

Methods inherited from Dom_FormElement
disable, getAttribute, getForm, getName, getNode, getTemplate, getType, getValue, isDisabled, setAttribute, setName, setValue

Method Detail

appendOptGroup

public DOMElement appendOptGroup(mixed label, string optGroup, string The)

Append an 'OptGroup' to the base node or the optGroup

Parameters:
The - label for the optGroup
optGroup - Append to this optgroup if it exists

appendOption

public DOMElement appendOption(mixed text, mixed value, string optGroup, string The)

Append an 'Option' to this 'Select' object

If no value is supplied the text parameter is used as the value.

NOTE: Ensure no comment nodes are in the select's node tree.

Parameters:
The - text shown in the dropdown
The - value for the select option
optGroup - Use this optgroup if it exists

clearSelected

public void clearSelected()

Clear all selected elements


clearSelectedFunction

private DOMElement clearSelectedFunction(DOMElement node, string name)

Find the opt group node with the name


enableMultiple

public void enableMultiple(boolean b)

Set the select list to handle multiple selections NOTE: When multiple is dissabled and multiple elements are selected it behaviour is unknown and browser specific.


findOptGroup

public DOMElement findOptGroup(DOMElement node, string name)

Find the opt group node with the name


findOption

public DOMElement findOption(DOMElement node, string value)

Find an option node


findSelected

public array findSelected(DOMElement node)

Find the selected values to this select box

Todo::
finish this code is buggy, what to do with the $value parameter.....

getValue

public mixed getValue()

Return the selected value, Will return an array if multiple select is enabled.

Returns:
Returns null if nothing selected.

isMultiple

public boolean isMultiple()

Return if this is a multiple select or not.

Returns:
Returns true if muliple selects are allowed

optGroupExists

public boolean optGroupExists(string name)

Check if the opt group exists


removeOptions

public void removeOptions()

Clear this 'select' element of all its 'option' elements.


setValue

public void setValue(string value)

Set the selected value of the form element

Parameters:
value - A string for single, an array for multiple

useTextNodes

public void useTextNodes(boolean b)

Use Text Nodes, Set to True by default


DomTemplate