summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TDropDownList.php
blob: 07549c6c71ef0823a5556e01822049830d3ae209 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

class TDropDownList extends TListControl implements IPostBackDataHandler
{
	protected function addAttributesToRender($writer)
	{
		$writer->addAttribute('name',$this->getUniqueID());
		parent::addAttributesToRender($writer);
	}

	public function loadPostData($key,$values)
	{
		if(!$this->getEnabled(true))
			return false;
		// ensure DataBound???
	}

	public function raisePostDataChangedEvent()
	{
		$page=$this->getPage();
		if($this->getAutoPostBack() && !$page->getPostBackEventTarget())
		{
			$page->setPostBackEventTarget($this);
			if($this->getCausesValidation())
				$page->validate($this->getValidationGroup());
		}
		$this->onSelectedIndexChanged(null);
	}

	public function getSelectedIndex()
	{
		$index=parent::getSelectedIndex();
		if($index<0 && $this->getItems()->getCount()>0)
		{
			$this->setSelectedIndex(0);
			return 0;
		}
		else
			return $index;
	}
}
?>