DB2 PHP Generator online Help
Prev | Return to chapter overview | Next |
getItemCount
Returns the number of checkbox group or a multiple select elements.
Signature:
function getItemCount()
Example:
The code below placed in the OnInsertFormEditorValueChanged and OnEditFormEditorValueChanged changes the content of the 'Clothes' checkbox group depending of the selected season.
if (sender.getFieldName() == 'season')
{
var $item_count = editors['clothes'].getItemCount();
if ($item_count == 6)
{
if (sender.getValue() == 'Winter')
{
editors['clothes'].removeItem('Shorts');
editors['clothes'].removeItem('Sandals');
editors['clothes'].removeItem('Swimsuit');
}
else
{
editors['clothes'].removeItem('Coat');
editors['clothes'].removeItem('Boots');
editors['clothes'].removeItem('Cap');
}
}
else
{
editors['clothes'].clear();
if (sender.getValue() == 'Winter')
{
editors['clothes'].addItem('Coat','Coat');
editors['clothes'].addItem('Boots','Boots');
editors['clothes'].addItem('Cap','Cap');
}
else
{
editors['clothes'].addItem('Shorts','Shorts');
editors['clothes'].addItem('Sandals','Sandals');
editors['clothes'].addItem('Swimsuit','Swimsuit');
}
}
}
The screenshot demonstrates the result of the fired event.
See also: removeItem, addItem, clear
Prev | Return to chapter overview | Next |