|
|
Test.page:
...
<com:TActiveButton
ID="activeButton"
Text="Fire Callback"
OnClick="onActiveButtonClicked" />
<com:TButton
ID="passiveButton"
Text="Fire Postback"
OnClick="onButtonClicked" />
...
Test.php:
...
public function onActiveButtonClicked( $sender, $param )
{
print "onActiveButtonClicked";
$this->CallbackClient->click( $this->passiveButton );
}
public function onButtonClicked( $sender, $param )
{
print "onButtonClicked";
}
...
2. Click "Fire Callback" button.
The page should be reloaded and "onButtonClicked" displayed on it.
That works fine in FF and Opera but not in IE7 and IE8. On IE it prints to
JavaScript console:
HTTP 200 with response :
onCallbackClicked
Actions :
{"Prado.Element.click":["ctl0_ctl0_body_main_passiveButton"]}
but the button is not actually clicked.
I found two problems here. IE doesn't like when client side function is
called "click". I've fixed that renaming function to something like "click_on":
TCallbackClientScript.php,113:
...
/**
* Client script to click on an element. <b>This client-side function
* is unpredictable.</b>
* @param TControl control element or element id
*/
public function click($control)
{
$this->callClientFunction('Prado.Element.click_on', $control);
}
...
scriptaculous-adapter.js,251:
...
/**
* Trigger a click event on a DOM element.
*
* @function ?
* @param {string} element - Element id
*/
click_on : function(element)
{
var el = $(element);
if(el)
Event.fireEvent(el,'click');
},
...
Second problem is that as promised the client side function is
unpredictable. So, I've just changed Event.fireEvent(el,'click') to simple
el.click(); Of course that works for buttons only, but at least that works!
click_on : function(element)
{
var el = $(element);
el.click();
},
---
Prado 3.1.6, Gentoo x86.
|