Control API for Dropdown List Box (dropdownListBox)

A control with a dropdown arrow that the user clicks to display a list of options. An item in the dropdownListBox is called listBoxItem.

  • disabled
    A boolean value that defines if the dropdownListBox is clickable. If the dropdownListBox is disabled it is not selectable. A disabled dropdownListBox has a different color for the displayed listBoxItem.
  • id
    Identification name of the dropdownListBox.
  • model
    Defines the model which provides the dropdownListBox with data.
  • nameOfKeyColumn
    Specifies the name of the column that contains the key. This is used when you use an underlying table in the model.
  • nameOfValueColumn
    Specifies the name of the column that contains the visible text. This is used when you use an underlying table in the model.
  • onSelect
    Defines the action that will be processed when the user clicks on the enabled dropdownListbox. If you do not define a onClick event the dropdownListbox can be clicked but no event is generated.
  • onClientSelect    
    Defines the JavaScript fragment that is executed when the user clicks on the dropdownListbox. If both events ('onClick' and 'onClientSelect') are specified, the 'onClientSelect' event is activated first. By default the 'onClick' event is activated afterwards. In the JavaScript fragment you can cancel the activation of the 'onClick' event with the command

    htmlbevent.cancelSubmit=true;

    The 'onClientSelect' event is very useful to save client/server interaction.

    Example
    A dropdownListbox click usually activates the client/server interaction. If an input field has to be filled out for further processing, the JavaScript fragment can check the necessary input on the client side and display a message if the necessary input is missing, without server interaction.

    Note
    To use JavaScript the JSP has to use the page tag (see page tag).

 

  • selection
    Specifies the key of the listBoxItem which is displayed in the dropdownListBox.
  • tooltip
    Defines the hint of the dropdownListBox which is displayed as the mouse cursor passes over the dropdownListBox, or as the mouse button is pressed but not released.
  • width
    Defines the width of the dropdownListBox in pixel or percent.
attribute req. values default case sens. JSP taglib classlib
disabled no TRUE
FALSE
FALSE yes disabled="True" setDisabled(true)
id yes String none yes id="listbox_te"  
model no String none yes model="myBean.model" setModel((IlistModel) model)
nameOfKeyColumn no String none no nameOfKeyColumn("k1") setNameOfKeyColumn("k1")
nameOfValueColumn no String none no nameOfValueColumn("v1") setNameOfValueColumn("v1")
selection no String none yes selection("HD") setSelection("HD")
tooltip no String none no tooltip="select a item" setTooltip("select a item")
width no Unit 150 - width="200" setWidth("200")

 

events req. values default case sens. JSP taglib classlib
onClientSelect no String none yes onClientSelect="JavaScript" setOnClientSelect("JavaScript")
onSelect no String none yes onSelect="proc_listbox" setOnSelect("proc_listbox")

 

 

listBoxItem

Defines the items in a dropdownListBox or listBox instead of the model.

  • key
    A string which is passed on to the event handling routine when the event occurs. A key string has be defined and must not be empty. Each listBoxItem must have an unique key.
  • selected
    A boolean value.
    selected="false": no effect

    selected:="true"

    dropdownListBox:
    The item is displayed in the dropdownListBox. It overrules the "selection" attribute of the dropdownListBox. If several listBoxItems are selected the last defined listBoxItem is displayed in the dropdownListBox.

    listBox:
    selected="true": The item is displayed as selected in the listBox.
  • value
    Defines the text string displayed in the dropdownListBox or listBox. A 'value' string has be defined and must not be empty.
attribute req. values default case sens. JSP taglib classlib
key yes

string

none yes key="WD" addItem("WD","Walldorf")
selected no

FALSE
TRUE

FALSE no selected="true" addItem("WD","Walldorf")
addSelection("WD")
value yes String none no value="Walldorf" see "key"

 

Example
<hbj:dropdownListBox
           id="DDCitiesNearby"
           tooltip="Cities surounding SAP"
           selection="WD"
           disabled="false"
           nameOfKeyColumn="KeyCol"
           nameOfValueColumn="KeyVal"
           onSelect="ProcessCity"
           onClientSelect="PreprocessCity"
           >

              <hbj:listBoxItem key="HD" value="Heidelberg"    />
              <hbj:listBoxItem key="HK" value="Hockenheim"    />
              <hbj:listBoxItem key="WD" value="Walldorf"      />
              <hbj:listBoxItem key="WL" value="Wiesloch"      />
</hbj:dropdownListBox>

Result