auFormSelect

From auWiki
Jump to: navigation, search

The auFormSelect class is part of the auLib package. It is defined in the auForm.php file.

Hierarchy

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.