auFormFieldset

From auWiki
Jump to navigation Jump to search

The auFormFieldset class is part of the auLib package. It is defined in the auForm.php file. It represents a set of fields and is normally rendered with a border around all the fields it contains and a title at the top of the border.

Hierarchy

Usage

Create a field set from this class, add elements to it using Add(), and then add it to a form.

Public Functions

new auFormFieldset

new auFormFieldset($title, $id, $class)

Creates a new field set.

  • $title = Text to display at the top of the field set.
  • $id = ID of the field set, for CSS and / or JavaScript.
  • $class = CSS class name of the field set.

Add

Add($element)

Adds an element to the field set.

AddData

AddData($name, $value)

Deprecated: Use Add(new auFormData(...)) instead.

Adds data to the field set that will not display but will be submitted.

  • $name = Name to submit the data as.
  • $value = Value of the data.

AddText

AddText($title, $text)

Deprecated: Use Add(new auFormText(...)) instead.

Adds text to the field set that will display but will not be submitted.

  • $title = Title of the text, which displays like a field label.
  • $text = Text to display.

AddHTML

AddHTML($title, $html)

Deprecated: Use Add(new auFormHTML(...)) instead.

Adds HTML to the field set that will display but will not be submitted. This can also be used to add custom fields, but they will have to be validated manually.

  • $title = Title of the text, which displays like a field label.
  • $html = The text to display.

AddField

AddField($name, $label, $tooltip, $required, $default, $type, $width, $maxlength)

Deprecated: Use Add() with the appropriate auFormElement instead.

Adds a field to the field set.

  • $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. For checkbox fields, the tooltip displays next to the checkbox itself. Default is none.
  • $required = Whether a value is required in this field. Default is not required. Ignored for some field types.
  • $default = Default value for this field. Default is blank / unchecked.
  • $type = Type of field. Should be an _AU_FORM_FIELD_* value.
  • $width = Width of the field in characters. Default is browser default.
  • $maxlength = The maximum number of characters the field can accept. Default is unlimited. Ignored for checkboxes and file fields.

AddSelect

AddSelect($name, $label, $tooltip, $values, $default, $type)

Deprecated: Use Add(new auFormSelect(...)) instead.

Adds a one-value selection field to the field set.

  • $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.
  • $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.

AddMultiSelect

AddMultiSelect($name, $label, $tooltip, $values, $default, $type)

Deprecated: Use Add(new auFormMultiSelect(...)) instead.

Adds a multiple-value selection field to the field set.

  • $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.
  • $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 = Array of default values for this field. Default is for no values to be selected.
  • $type = Type of field -- set to _AU_FORM_MULTI_LIST to use list box. Default is _AU_FORM_MULTI_CHECK for checkboxes.

AddButtons

AddButtons($text, $tooltip, $name)

Deprecated: Use Add(new auFormButtons(...)) instead.

Adds submit buttons to the field set.

  • $text = Text to display on the button. Pass an array to have multiple buttons on one line.
  • $tooltip = Tooltip text to display when the mouse is over the button. Pass an array parallel to $text if $text was an array. Default is none.
  • $name = Name that should be used for the button. Must be the same for all buttons. Default is 'submit'.