public function setSelectedIndex($index)
{
if ($this->canUpdateClientSide()) {
$this->updateListItems();
// if a prompt is set, we mimic the postback behaviour of not counting it
// in the index. We assume the prompt is _always_ the first item (Issue #368)
$promptValue = $this->getControl()->getPromptValue();
if ($promptValue === '') {
$promptValue = $this->getControl()->getPromptText();
}
if ($promptValue !== '') {
$index++;
}
if ($index >= 0 && $index <= $this->getControl()->getItemCount()) {
$this->getPage()->getCallbackClient()->select($this->getControl(), 'Index', $index);
}
}
}