listbox.formwidget
the
<listbox class="formwidget"
can be used in two ways:
- without listcols,
in which case the listbox only contains listitems
with a
name and value and no further content.
In this case, the listbox holds the name, and the selected
listitems hold the value/label. If a listitem is a checkbox,
it only returns it's value when checked.
If such a listbox is multiple select, it may return multiple values.
When seeding, if a listitem matches the given value, it is selected
and optionally checked.
If it previously had no label, the label is set, otherwise the given label
is ignored. if no listitem matches the given value, a new disabled
listitem with the given label/value is appended.
- with listcols,
in which case all listitems should have content. A common example of
listitem content are listcells.
But a listitem can contain any other
valid formwidget element. The <listbox class="formwidget"
traverses the selected or checked listitems
, harvesting the
<listcell class="formwidget"
and any other formwidgets it finds.
The name of the listbox is ignored.
When seeding, listcells behave different than other content that
may be in a listitem. For more info, see listcells.
Note: In XUL, once a listitem is selected, it's impossible to undo the
selection and select 'nothing'. You might want to add your own 'select none'
button somewhere.
Note2: allthough listitems can contain any type of XUL element, most of them
loose their interaction, which renders them useless, as the testsuite
demonstrates ... if anyone knows how to prevent that let me know.
Note3: when seeding, checkbox listitems are never unchecked.
Such is the nature of a checkbox: if it is not checked,
it doesn't mean it should be unchecked; it means nothing.
If you need a switch, use the listbox autocheck attribute
with a seltype=single.
Example:
result:
Seed: "mybox/bpecan/Butter Pecan", "mybox/chestnut/Chestnut"
CGI: "mybox=bpecan&mybox=chestnut"
Additional Attributes:
name
The name of the widget. Used as the name of the variable in CGI
-
onvalidate
pseudo event handler. should point to a method to execute
for validation. when validating, the method will receive a bucket
with seeds in it, reflecting the name of the listbox and the values
and labels of the selected listitems.
Additional Properties:
-
numcols
The number of colums on the listbox. Quite usefull :)
Additional Methods: