auFormSelect: Difference between revisions
Appearance
Misterhaan (talk | contribs) No edit summary |
Misterhaan (talk | contribs) |
||
Line 14: | Line 14: | ||
==Public Functions== | ==Public Functions== | ||
===new auFormSelect=== | ===new auFormSelect=== | ||
<code>new auFormSelect($name, ''$label'', ''$tooltip'', ''$values'', ''$default'', ''$type'')</code> | <code>new auFormSelect($name, ''$label'', ''$tooltip'', ''$required'', ''$values'', ''$default'', ''$type'')</code> | ||
Creates a one-value selection field. | Creates a one-value selection field. | ||
Line 21: | Line 21: | ||
* ''$label'' = Label to display with the field. Default is blank. | * ''$label'' = Label to display with the field. Default is blank. | ||
* ''$tooltip'' = Tooltip text to display when the mouse is over the label. Default is none. | * ''$tooltip'' = Tooltip text to display when the mouse is over the label. Default is none. | ||
* ''$required'' = Whether a value is required in this field. Default is not required. | |||
* ''$values'' = Associative array of possible values (value => display text). If values and display text are all identical, a normal array can be passed through auFormSelect::ArrayIndex($array) to get it into the appropriate format. Default is no possible values. | * ''$values'' = Associative array of possible values (value => display text). If values and display text are all identical, a normal array can be passed through auFormSelect::ArrayIndex($array) to get it into the appropriate format. Default is no possible values. | ||
* ''$default'' = Default value for this field. Default is browser default, which is usually the first of the possible values. | * ''$default'' = Default value for this field. Default is browser default, which is usually the first of the possible values. |
Latest revision as of 13:20, 12 May 2008
The auFormSelect class is part of the auLib package. It is defined in the auForm.php file.
- Hierarchy
- auFormElement
- auFormField
- auFormSelect
- auFormField
Usage
This class is used to add a one-value selection field to a form. Create an object from this class and add it to an auFormContainer object.
Public Functions
new auFormSelect
new auFormSelect($name, $label, $tooltip, $required, $values, $default, $type)
Creates a one-value selection field.
- $name = Name to submit the field as.
- $label = Label to display with the field. Default is blank.
- $tooltip = Tooltip text to display when the mouse is over the label. Default is none.
- $required = Whether a value is required in this field. Default is not required.
- $values = Associative array of possible values (value => display text). If values and display text are all identical, a normal array can be passed through auFormSelect::ArrayIndex($array) to get it into the appropriate format. Default is no possible values.
- $default = Default value for this field. Default is browser default, which is usually the first of the possible values.
- $type = Type of field -- set to _AU_FORM_SELECT_RADIO to use radio buttons. Default is _AU_FORM_SELECT_DROPDOWN for a dropdown selection.
ArrayIndex
ArrayIndex($array)
Translates a normal array into an associative array for use in the values parameter of the auFormSelect constructor. This is a static function.
- $array = Normal array to translate.
- @return = Array translated into associative form.