FormLib
[ class tree: FormLib ] [ index: FormLib ] [ all elements ]

Class: Listbox

Source Location: /FormLib/Listbox.php

Class Overview

Field
   |
   --Listbox

An object-oriented wrapper around an HTML listbox.


Author(s):

  • Randy

Version:

  • 0.1

Methods


Inherited Variables

Inherited Methods

Class: Field

Field::__construct()
Constructor
Field::display()
Function to render the field as HTML.
Field::displayField()
Renders the field as HTML. Must be overridden in child classes.
Field::isValid()
Checks to see if the data entered into a field is valid.
Field::__get()
Property accessor.
Field::__set()
Property mutator.

Class Details

[line 45]
An object-oriented wrapper around an HTML listbox.

You must supply either an array or a PropertyHolder object with the list of items to be added to the listbox. This class will always make the first item in the list "--Please Select--" with a value of -1. This can be suppressed by setting the showPleaseSelect property to false after constructing the Listbox object.

Here is an example:

  1.  <?php
  2.    $mybox new Listbox("mybox""Select Color:",
  3.        array('red' => "Bright Red""blue" => "Baby Blue""green" => "Lime Green"));
  4.  ?>

Another example using a PropertyBag object:

  1.  <?php
  2.    $myitems new PropertyBag(
  3.        "red" => "Bright Red",
  4.        "blue" => "Baby Blue",
  5.        "green" => "Lime Green");
  6.    $mybox new Listbox("mybox""Select Color:"$myitems);
  7.  ?>

When the user selects one of the items, the <em>value</em> property will be set to the value. For example, if the user chooses the 'Bright Red' option, the <em>value</em> property will be set to 'red'.




Tags:

author:  Randy
version:  0.1


[ Top ]


Class Methods


constructor __construct [line 57]

Listbox __construct( string $name, string $label, array/PropertyHolder $options, [any $value = ""], [PropertyHolder $style = false], PropertyHolder $properties)

Constructor.



Tags:

access:  public


Overrides Field::__construct() (Constructor)

Parameters:

string   $name   Name assigned to the list box.
string   $label   Label for the list box.
array/PropertyHolder   $options   List of value/name pairs.
any   $value   The selected item in the list.
PropertyHolder   $properties   Extra properties to attach to the list box.
PropertyHolder   $style   Additional style hinting information.

[ Top ]

method displayField [line 76]

void displayField( PropertyHolder $formStyle)

Renders the list box as HTML.



Tags:

access:  protected


Overrides Field::displayField() (Renders the field as HTML. Must be overridden in child classes.)

Parameters:

PropertyHolder   $formStyle   The form's style options. (Not used)

[ Top ]


Documentation generated on Wed, 15 Nov 2006 08:48:05 -0600 by phpDocumentor 1.3.1