main | downloads | documentation | comunity | about lionframework

Class: __ComboBoxComponent


Class Overview

Combobox is a combination of a drop-down list or list box and a single-line textbox, allowing the user either to choose from the list of existing options.


Combobox tag is "combobox"

i.e.

  1.    <comp:combobox name="number_of_employees"/>

A combobox is a subclass of __ItemListComponent, which is compound by a list of __ItemComponent instances.
A __ItemComponent is a component containing a pair text, value.

We can setup the combobox items by ussing the "item" tag:

i.e.

  1.    <comp:combobox name="number_of_employees">
  2.      <comp:item value="1" text="1 to 10"/>
  3.      <comp:item value="2" text="11 to 20"/>
  4.      <comp:item value="3" text="21 to 50"/>
  5.      <comp:item value="4" text="more than 50"/>
  6.    </comp:combobox>

We can also setup a combobox within the eventhandler code (typically within the beforeRender (each time the view is rendered) or within the component create event (once the component is created).

i.e.

  1.    public function beforeRender({
  2.        $combobox $this->getComponent('number_of_employees');
  3.        $combobox->addItem(new __Item(1'1 to 10'));
  4.        $combobox->addItem(new __Item(2'11 to 20'));
  5.        $combobox->addItem(new __Item(3'21 to 50'));
  6.        $combobox->addItem(new __Item(4'more than 50'));
  7.    }

We can select only one item within a combobox, which represents the value for that component. For that purpose, we can:

i.e.
  1.    <comp:combobox name="number_of_employees">
  2.      <comp:item value="" text="Please select" selected="true"/>
  3.      <comp:item value="1" text="1 to 10"/>
  4.      <comp:item value="2" text="11 to 20"/>
  5.      <comp:item value="3" text="21 to 50"/>
  6.      <comp:item value="4" text="more than 50"/>
  7.    </comp:combobox>

A combobox, as a value holder, returns the value of the selected item as a result of call to the getValue.

i.e.

  1.    public function number_of_employees_change(__UIEvent &$event{
  2.       //get the value of the selected item within the combo:
  3.       $combo_value $event->getComponent()->getValue();
  4.  
  5.       //...
  6.    }
}

Default events associated to a combobox are the same as associated to a html select element. Most usefull is the change event, raised when the user change the selection.


See the combobox component in action here: http://www.lionframework.org/components/combobox.html


Author:  Antonio Parraga Navarro
Version:  1.1.125 beta
Copyright:  Copyright (c) 2008 Antonio Parraga Navarro
See:  __ItemListComponent, __ListBoxComponent
__UIComponent
   |
   --__UIContainer
      |
      --__InputComponent
         |
         --__ItemListComponent
            |
            --__ComboBoxComponent
[ Top ]

Direct descendents

Child Class Description
__ListBoxComponent A listbox component represents a control to display a list of items, showing more than one item at the same time.

[ Top ]

Inherited Properties, Constants, and Methods

Inherited Properties Inherited Methods Inherited Constants

Inherited From __ItemListComponent

Inherited From __InputComponent

Inherited From __UIContainer

Inherited From __UIComponent

Inherited From __ItemListComponent

Inherited From __InputComponent

Inherited From __UIContainer

Inherited From __UIComponent

Inherited From __ItemListComponent


[ Top ]

Properties

Methods

Copyright (c) 2008, www.lionframework.org