summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/TClientScriptManager.php2
-rw-r--r--framework/Web/UI/TPage.php14
2 files changed, 15 insertions, 1 deletions
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index 30009c63..49a34a02 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -201,6 +201,7 @@ class TClientScriptManager extends TApplicationComponent
$options = TJavaScript::encode($this->getDefaultButtonOptions($panel, $button));
$code = "new Prado.WebUI.DefaultButton($options);";
$this->registerEndScript("prado:".$panel->getClientID(), $code);
+ $this->registerHiddenField(TPage::FIELD_POSTBACK_TARGET,'');
$this->registerPradoScript('prado');
}
@@ -225,6 +226,7 @@ class TClientScriptManager extends TApplicationComponent
{
$options['Panel'] = $panel->getClientID();
$options['Target'] = $button->getClientID();
+ $options['EventTarget'] = $button->getUniqueID();
$options['Event'] = 'click';
return $options;
}
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php
index 8c01a501..f3fe7fc9 100644
--- a/framework/Web/UI/TPage.php
+++ b/framework/Web/UI/TPage.php
@@ -676,6 +676,14 @@ class TPage extends TTemplateControl
{
if($beforeLoad)
$this->_restPostData=new TMap;
+ //change the post back target
+ if(($target=$postData[self::FIELD_POSTBACK_TARGET])!==null
+ && ($control=$this->findControl($target))
+ && ($control instanceof IPostBackEventHandler))
+ {
+ $this->_postData->add(self::FIELD_POSTBACK_TARGET,$target);
+ }
+
foreach($postData as $key=>$value)
{
if($this->isSystemPostField($key))
@@ -687,13 +695,17 @@ class TPage extends TTemplateControl
if($control->loadPostData($key,$postData))
$this->_controlsPostDataChanged[]=$control;
}
- else if($control instanceof IPostBackEventHandler)
+ else if($control instanceof IPostBackEventHandler &&
+ empty($this->_postData[self::FIELD_POSTBACK_TARGET]))
+ {
$this->_postData->add(self::FIELD_POSTBACK_TARGET,$key); // not calling setPostBackEventTarget() because the control may be removed later
+ }
unset($this->_controlsRequiringPostData[$key]);
}
else if($beforeLoad)
$this->_restPostData->add($key,$value);
}
+
foreach($this->_controlsRequiringPostData as $key=>$value)
{
if($control=$this->findControl($key))