CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
HtmlOptionList Class Reference

Convenience class for generating an HTML select/option form element. More...

## Public Member Functions
| __construct ($ResultVar, $Options, $SelectedValue=NULL)
| Class constructor. More...
| PrintHtml ()
| Print HTML for list. More...
| GetHtml ()
| Get HTML for list. More...
| DisabledOptions ($Options=NULL)
| Get/set disabled options. More...
| SelectedValue ($NewValue=NULL)
| Get/set currently selected value or array of currently selected values. More...
| Size ($NewValue=NULL)
| Get/set the list size (number of visible items). More...
| MultipleAllowed ($NewValue=NULL)
| Get/set whether multiple items may be selected. More...
| SubmitOnChange ($NewValue=NULL)
| Get/set whether to submit the form when the list value is changed. More...
| OnChangeAction ($NewValue=NULL)
| Get/set action to take if form is submitted on change. More...
| PrintIfEmpty ($NewValue=NULL)
| Get/set whether list should be output even if there are no items. More...

## Detailed Description

Convenience class for generating an HTML select/option form element.

Definition at line 13 of file HtmlOptionList.php.

## Constructor & Destructor Documentation

HtmlOptionList::__construct | ( |  | $ResultVar,
|  |  | $Options,
|  |  | $SelectedValue = `NULL`
| ) |  |

Class constructor.

Parameters

  string | $ResultVar | Name of form variable for select element.
  array | $Options | Array of options, with form values for the array index and labels for the array values.
  mixed | $SelectedValue | Currently selected form value or array of currently selected form values. (OPTIONAL)

Definition at line 25 of file HtmlOptionList.php.

References SelectedValue().

## Member Function Documentation

HtmlOptionList::DisabledOptions | ( |  | $Options = `NULL` | ) |

Get/set disabled options.

Parameters

  mixed | $Options | Option or array of options to disable. If a single option then it should be the value and will be added to any existing disabled options, and if an array it should have the values for the index and will replace the current list of disabled options. (OPTIONAL)

Definition at line 106 of file HtmlOptionList.php.

Referenced by GetHtml().

Here is the caller graph for this function:

HtmlOptionList::GetHtml | ( |  | ) |

Get HTML for list.

Returns
  string Generated HTML.

Definition at line 44 of file HtmlOptionList.php.

References DisabledOptions(), MultipleAllowed(), OnChangeAction(), PrintIfEmpty(), SelectedValue(), Size(), and SubmitOnChange().

Referenced by PrintHtml().

Here is the caller graph for this function:

HtmlOptionList::MultipleAllowed | ( |  | $NewValue = `NULL` | ) |

Get/set whether multiple items may be selected.

Defaults to FALSE.

Parameters

  bool | $NewValue | If TRUE, users will be able to select multiple items. (OPTIONAL)

Returns
  bool TRUE if users can select multiple items, otherwise FALSE.

Definition at line 157 of file HtmlOptionList.php.

Referenced by GetHtml().

Here is the caller graph for this function:

HtmlOptionList::OnChangeAction | ( |  | $NewValue = `NULL` | ) |

Get/set action to take if form is submitted on change.

Defaults to "submit()" (without the quotes). No character escaping or other processing is done to this value before it is added to the HTML, so whatever is passed in must be pre-sanitized if needed, including escaping any double quotation marks. This setting has no effect if SubmitOnChange() is set to FALSE.

Parameters

  string | $NewValue | New action. (OPTIONAL)

Returns
  string Current action.

See also
  HtmlOptionList::SubmitOnChange()

Definition at line 194 of file HtmlOptionList.php.

Referenced by GetHtml().

Here is the caller graph for this function:

HtmlOptionList::PrintHtml | ( |  | ) |

Print HTML for list.

Definition at line 35 of file HtmlOptionList.php.

References GetHtml().

HtmlOptionList::PrintIfEmpty | ( |  | $NewValue = `NULL` | ) |

Get/set whether list should be output even if there are no items.

If this is set to FALSE and there are no items in the list, GetHtml() will return an empty string and PrintHtml() will print nothing. Defaults to TRUE.

Parameters

  bool | $NewValue | If TRUE, HTML will be returned/printed even if there are no items in the list. (OPTIONAL)

Returns
  bool TRUE if empty list will be printed, otherwise FALSE.

Definition at line 212 of file HtmlOptionList.php.

Referenced by GetHtml().

Here is the caller graph for this function:

HtmlOptionList::SelectedValue | ( |  | $NewValue = `NULL` | ) |

Get/set currently selected value or array of currently selected values.

Parameters

  mixed | $NewValue | Currently selected form value or array of currently selected form values. (OPTIONAL)

Returns
  mixed Selected value or array of currently selected values.

Definition at line 128 of file HtmlOptionList.php.

Referenced by __construct(), and GetHtml().

Here is the caller graph for this function:

HtmlOptionList::Size | ( |  | $NewValue = `NULL` | ) |

Get/set the list size (number of visible items).

Defaults to 1.

Parameters

  int | $NewValue | Current size. (OPTIONAL)

Returns
  int Current size.

Definition at line 142 of file HtmlOptionList.php.

Referenced by GetHtml().

Here is the caller graph for this function:

HtmlOptionList::SubmitOnChange | ( |  | $NewValue = `NULL` | ) |

Get/set whether to submit the form when the list value is changed.

Defaults to FALSE.

Parameters

  bool | $NewValue | If TRUE, form will be submitted on change. (OPTIONAL)

Returns
  bool TRUE if form will be submitted, otherwise FALSE.

See also
  HtmlOptionList::OnChangeAction()

Definition at line 174 of file HtmlOptionList.php.

Referenced by GetHtml().

Here is the caller graph for this function:

The documentation for this class was generated from the following file:

- lib/ScoutLib/HtmlOptionList.php