diff options
author | xue <> | 2005-12-11 15:29:28 +0000 |
---|---|---|
committer | xue <> | 2005-12-11 15:29:28 +0000 |
commit | 1383f795d11e3960d681d369c1497a9944cf35e9 (patch) | |
tree | 01c8527a30e286ed3ed76f9b251899a7e1fd6daa /framework/Web/UI/TPage.php | |
parent | d8d14cd6b09a158c5010356bf14aee76f60a900b (diff) |
Modified setFocus so that it can focus on arbitrary element on a page rather than just controls.
Diffstat (limited to 'framework/Web/UI/TPage.php')
-rw-r--r-- | framework/Web/UI/TPage.php | 13 |
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;
}
|