org.seanmonahan
[ class tree: org.seanmonahan ] [ index: org.seanmonahan ] [ all elements ]

Class: FormSelect

Source Location: /FormSelect.class.php

Class Overview

FormField
   |
   --FormSelect

The FormField class.


Author(s):

  • Sean Monahan

Version:

  • 1.0

Copyright:

  • 2008 Sean Monahan

Methods


Inherited Methods

Class: FormField

FormField::__construct()
This is the base class for all HTML form fields.
FormField::addClassName()
Adds a class name to the existing list of classes.
FormField::addEventListener()
Adds an event listeners to the field.
FormField::className()
Getter for $_action.
FormField::eventListeners()
Getter for $_eventListeners.
FormField::fieldType()
Getter for $_fieldType;
FormField::isDisabled()
Getter for $_isDisabled.
FormField::label()
Getter for $_method.
FormField::name()
Getter for $_name.
FormField::setClassName()
Setter for $_className.
FormField::setFieldType()
Setter for $_fieldType.
FormField::setIsDisabled()
Setter for $_isDisabled.
FormField::setLabel()
Setter for $_label.
FormField::setName()
Setter for $_name
FormField::setSize()
Setter for $_size.
FormField::size()
Getter for $_size.
FormField::type()
Getter for $_type.

Class Details

[line 18]
The FormField class.

PHP Version 5

LICENSE: This source file is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License. http://creativecommons.org/licenses/by-sa/3.0/us/




Tags:

author:  Sean Monahan
version:  1.0
copyright:  2008 Sean Monahan


[ Top ]


Class Methods


constructor __construct [line 57]

FormSelect __construct( [array $options = null], [string $name = ""], [string $label = ""], [string $className = ""], [bool $isDisabled = false], [bool $allowMultipleSelections = false], [bool $size = -1])

This class builds an HTML <select>.



Tags:

access:  public


Overrides FormField::__construct() (This is the base class for all HTML form fields.)

Parameters:

array   $options   The list of options for the <select>.
string   $name   The name for the <select>. Also sets the id.
string   $label   The label for the <select>.
string   $className   The CSS class for the <select>.
bool   $isDisabled   Sets the <select> to disabled. Default: false.
bool   $allowMultipleSelections   Allows multiple items in the <select> to be selected. Default: false.
bool   $size   Sets the number of visible items in the <select>. Default: -1 (unlimited).

[ Top ]

method addOption [line 128]

bool addOption( array $option)

Adds a new option to the list of existing options.

Option must be of the form: $option = array("value" => $value, "option" => $option); Where "value" is the value attribute of the option and "option" is the text that will be displayed in the drop down.




Tags:

return:  Returns true.
access:  public


Parameters:

array   $option   The option to add.

[ Top ]

method allowMultipleSelections [line 88]

bool allowMultipleSelections( )

Getter for $_allowMultipleSelections.



Tags:

return:  Whether multiple selections are allowed or not.
access:  public


[ Top ]

method options [line 78]

array options( )

Getter for $_options.



Tags:

return:  Returns the options set for the select.
access:  public


[ Top ]

method setAllowMultipleSelections [line 108]

void setAllowMultipleSelections( bool $value)

Setter for $_allowMultipleSelections.



Tags:

access:  public


Parameters:

bool   $value   True to allow, false to disallow.

[ Top ]

method setOptions [line 98]

void setOptions( string $value)

Setter for $_options



Tags:

access:  public


Parameters:

string   $value   The options for the select.

[ Top ]

method setSelectedOptionByIndex [line 170]

bool setSelectedOptionByIndex( int $index)

Setter for $_selectedIndex.

Sets the index the drop down should have selected.




Tags:

return:  Returns true of the selected option is set. False otherwise.
access:  public


Parameters:

int   $index   The index to be selected.

[ Top ]

method setSelectedOptionByValue [line 142]

bool setSelectedOptionByValue( mixed $value)

Setter for $_selectedValue.

Sets the value the drop down should have selected. Removes any other selection settings.




Tags:

return:  Returns true on success. False if the option doesn't exist.
access:  public


Parameters:

mixed   $value   The drop down value to be selected.

[ Top ]


Documentation generated on Mon, 15 Dec 2008 21:14:24 -0700 by phpDocumentor 1.4.1