summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2005-12-11 15:29:28 +0000
committerxue <>2005-12-11 15:29:28 +0000
commit1383f795d11e3960d681d369c1497a9944cf35e9 (patch)
tree01c8527a30e286ed3ed76f9b251899a7e1fd6daa /framework
parentd8d14cd6b09a158c5010356bf14aee76f60a900b (diff)
Modified setFocus so that it can focus on arbitrary element on a page rather than just controls.
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/UI/TPage.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php
index fc63b7e3..ccbb12d4 100644
--- a/framework/Web/UI/TPage.php
+++ b/framework/Web/UI/TPage.php
@@ -705,8 +705,13 @@ class TPage extends TTemplateControl
$cs=$this->getClientScript();
if($this->getClientSupportsJavaScript())
{
- if($this->_focusedControl && $this->_focusedControl->getVisible(true))
- $cs->registerFocusScript($this->_focusedControl->getClientID());
+ if($this->_focusedControl)
+ {
+ if(is_string($this->_focusedControl))
+ $cs->registerFocusScript($this->_focusedControl);
+ else if(($this->_focusedControl instanceof TControl) && $this->_focusedControl->getVisible(true))
+ $cs->registerFocusScript($this->_focusedControl->getClientID());
+ }
else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null)
$cs->registerFocusScript($lastFocus);
if($this->_maintainScrollPosition && $this->_postData)
@@ -728,9 +733,9 @@ class TPage extends TTemplateControl
/**
* Sets input focus on a control after the page is rendered to users.
- * @param TControl control to receive focus
+ * @param TControl|string control to receive focus, or the ID of the element on the page to receive focus
*/
- public function setFocus(TControl $value)
+ public function setFocus($value)
{
$this->_focusedControl=$value;
}