tel8618217223380 / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

->CallbackClient->click doesn't work in IE7 and IE8 #203

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by mcsak...@gmail.com on 14 Oct 2009 at 2:24

GoogleCodeExporter commented 9 years ago
Moved to 3.2a... Need more testing.

Original comment by Christophe.Boulain@gmail.com on 22 Feb 2010 at 9:33

GoogleCodeExporter commented 9 years ago
Confirmed broken in internet explorer <=8, works on ie9, opera 11.51.

Original comment by ctrlal...@gmail.com on 22 Sep 2011 at 1:59

GoogleCodeExporter commented 9 years ago
fixed in r3041. Tested on internet explorer >= 6. It breaks compatibility with 
firefox < 2, but i hope nobody is still using that crap, while internet 
explorer 7/8 are still very popular for windows xp users.

Original comment by ctrlal...@gmail.com on 22 Sep 2011 at 2:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Fix r3041 breaks compatibility with Google Chrome (no action after clicking the 
button).

Original comment by zura...@gmail.com on 5 Oct 2011 at 10:38

GoogleCodeExporter commented 9 years ago
I've tested it with chrome both under windows and unix and it works, are you 
referring to a specific version of chrome?

Original comment by ctrlal...@gmail.com on 13 Oct 2011 at 5:14

GoogleCodeExporter commented 9 years ago
Hi, I'm using the newest version of Chrome (and my clients too). After applying 
the fix  , it stopped to work (no action after clicking the button). I've 
changed the file as on the page: 
http://code.google.com/p/prado3/source/detail?r=3041 .

Original comment by zura...@gmail.com on 16 Oct 2011 at 10:16