Welcome, Guest. Please login or register.
Did you miss your activation email?
Oct. 11, 2008, 11:05:15 AM
47669 Posts in 10453 Topics by 5339 Members
Latest Member: phamlehoaian
News: PRADO community toolbar eases your interaction with the PRADO community.
 
The PRADO Community » Prado v3.x » General Discussion » Active Controls (Ajax) » Firefox bug in showing panels? « previous next »
Pages: [1] Print
Author Topic: Firefox bug in showing panels?  (Read 1022 times)
Silver
Junior Member
**

Karma: 0
Offline Offline

Posts: 14


View Profile
« on: Feb. 19, 2008, 05:29:11 PM »

I have created a simple test to show a firefox bug changing Display property of Panels in an AJAX Callback.
I cannot reproduce this in IE.

.page
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<com:THead>
<meta http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</com:THead>

<body>
<com:TForm>

<com:TActiveButton id="showPanelsButton" onCallback="Page.onShowPanels" Text="ShowPanels"/>
<com:TActiveButton id="hidePanelsButton" onCallback="Page.onHidePanels" Text="HidePanels"/>
<com:TActiveButton id="showHidePanelsButton" onCallback="Page.onShowHidePanels" Text="ShowHidePanels"/>
<font size="-2">
<com:TActivePanel ID="panel0" Display="None" GroupingText="Panel 0">
  Panel 0 Content <com:TTextBox Id="txt0"/>

    <com:TActivePanel ID="panel1" Display="None"  GroupingText="Panel 1">
      Panel 1 Content <com:TTextBox Id="txt1"/>
    </com:TActivePanel>

    <com:TActivePanel ID="panel2" Display="None"  GroupingText="Panel 2">
      Panel 2 Content <com:TTextBox Id="txt2"/>
    </com:TActivePanel>

    <com:TActivePanel ID="panel3" Display="None"  GroupingText="Panel 3">
      Panel 3 Content <com:TTextBox Id="txt3"/>
    </com:TActivePanel>

</com:TActivePanel>
</font>
<com:TJavascriptLogger />
</com:TForm>

</body>
</html>

.php
Code:
<?php
Prado
::using('System.Web.UI.ActiveControls.*');

class 
Test extends TPage{  
    
    
    public function 
onShowPanels($sender,$param){
        
$this->panel0->Display "Dynamic";
        
$this->panel1->Display "Dynamic";
        
$this->panel2->Display "Dynamic";
        
$this->panel3->Display "Dynamic";
        
$this->panel0->render($param->NewWriter);        
    }

    public function 
onHidePanels($sender,$param){
        
$this->panel0->Display "None";
        
$this->panel1->Display "None";
        
$this->panel2->Display "None";
        
$this->panel3->Display "None";
        
$this->panel0->render($param->NewWriter);        
    }
    
    public function 
onShowHidePanels($sender,$param){
        
$this->panel0->Display "Dynamic";
        
$this->panel1->Display "None";
        
$this->panel2->Display "Dynamic";
        
$this->panel3->Display "None";
        
$this->panel0->render($param->NewWriter);        
    }
                  
}
?>


For the result of the first click see the attached image.
Logged
okhayat
Junior Member
**

Karma: 1
Offline Offline

Posts: 39


By teaching you learn!


View Profile
« Reply #1 on: Feb. 19, 2008, 10:32:48 PM »

In deed  Huh This isn't the case with FireFox 3 Beta 3 though! I tested the code and it works fine with FF3B3 and IE7!
Logged
rojaro
Senior Member
***

Karma: 22
Offline Offline

Posts: 422


PRADO aint no voodoo ...


View Profile WWW
« Reply #2 on: Feb. 20, 2008, 10:17:39 AM »

Well ... Firefox is not a perfect browser (although it's pretty close to be one), but i agree that there should be a fix or workaround for this. I suggest you post a new ticket for this at trac.pradosoft.com.

Greetings from Hamburg / Germany
- rojaro -
Logged

A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)
mikl
PRADO v3.x Developer
Platinum Member
*****

Karma: 51
Online Online

Posts: 733



View Profile
« Reply #3 on: Feb. 20, 2008, 11:21:30 AM »

I'd say this is not really a Firefox bug but merely a problem in Prado's AJAX clientcode when you use nested ActivePanels. The js implementations in IE and FF differ slightly. That's why the clientcode accidently works as expected in IE but causes problems in FF.

The example works if you use TPanels  for panels 1-3. Prado's Activecontrols still has problems in some cases.
Logged
rojaro
Senior Member
***

Karma: 22
Offline Offline

Posts: 422


PRADO aint no voodoo ...


View Profile WWW
« Reply #4 on: Feb. 20, 2008, 11:29:53 AM »

If the problem occurs with FF2 but not with FF3 the probability is very high that this problem is related to a bug in existing in FF2 that got fixed in FF3 especially since there is no distinction in the js code between FF2 and FF3.
« Last Edit: Feb. 20, 2008, 11:36:55 AM by rojaro » Logged

A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)
mikl
PRADO v3.x Developer
Platinum Member
*****

Karma: 51
Online Online

Posts: 733



View Profile
« Reply #5 on: Feb. 20, 2008, 12:10:27 PM »

Take a careful look on what prado does in the response of the AJAX request. Due to the nested ActivePanels it happens that multiple objects with the same ID are inserted into the DOM. That's not valid and thus you can't really tell what effect this has in which browser. Still: not a browser problem but a problem of prado's generated code.

When the page is loaded we have this HTML in the browser (reduced to the relevant parts):

Code:
<div id="panel0" style="display:none;"><fieldset><legend>Panel 0</legend>
  Panel 0 Content <input name="txt0" type="text" id="txt0" />

    <div id="panel1" style="display:none;"><fieldset><legend>Panel 1</legend>
      Panel 1 Content <input name="txt1" type="text" id="txt1" />
    </fieldset></div>

    <div id="panel2" style="display:none;"><fieldset><legend>Panel 2</legend>
      Panel 2 Content <input name="txt2" type="text" id="txt2" />
    </fieldset></div>

    <div id="panel3" style="display:none;"><fieldset><legend>Panel 3</legend>
      Panel 3 Content <input name="txt3" type="text" id="txt3" />
    </fieldset></div>

</fieldset></div>

On button click, something like this is sent back to the browser (reformatted):

Code:
<!--5f000729--><div id="panel0" style="display:;"><fieldset><legend>Panel 0</legend>
  Panel 0 Content <input name="txt0" type="text" id="txt0" />

    <div id="panel1" style="display:;"><fieldset><legend>Panel 1</legend>
      Panel 1 Content <input name="txt1" type="text" id="txt1" />
    </fieldset></div>

    <div id="panel2" style="display:;"><fieldset><legend>Panel 2</legend>
      Panel 2 Content <input name="txt2" type="text" id="txt2" />
    </fieldset></div>

    <div id="panel3" style="display:;"><fieldset><legend>Panel 3</legend>
      Panel 3 Content <input name="txt3" type="text" id="txt3" />
    </fieldset></div>

</fieldset></div><!--//5f000729--><!--X-PRADO-PAGESTATE-->eJztlc1ygyAcxPMsPAGINoqnJj20lzbTj3MGFRKmKFbIpGmm715QjI5p781MvLn7g/3DzmgSJYiHWYwxLGDMI55AXMCQ4RgjlvE5j3AIs5hTgshREJhSgslRk5CA3EgI7Dskx+9eQE6IHIBuCNBbtV/Rikm92BmjqoF27lYU7Hc3gN3a+z8Ju7x2Bjzl2XzzaeA50o4UDAjqke40yDkRAS/mIBlInwhCBLy2qZ3kBIsEdr/ZSJ+tM5q/P5R0w94aCdLH1DJ4yhSiYbkRbvQWSKbAVjXiS1WGylspNj0WTjGdN0rKBW10R6B4SuwbWnsvcp6XuWCy0KA/6JyAQuha0gOwpL1mkLo28HiFncZvFI7kXFLtw109g77TRpX+9loXjVwf5u02/+5Q0VLk4BSwVGWtKlaZ2Zr13dhnaDCYNBhcG7ywBvGkQXxt8CIavNbzr+vp/7qnD+K4sMCecWkHtbein9nHTjSi2qyUNgtbymiTH4Lvifg=<!--//X-PRADO-PAGESTATE--><!--6a8ee784--><script type="text/javascript">
/*<![CDATA[*/
new Prado.WebUI.TTextBox({'ID':'txt0','EventTarget':'txt0','AutoPostBack':false,'CausesValidation':true,'TextMode':'SingleLine','FormID':'ctl1'});
Prado.CallbackRequest.addPostLoaders(['txt0','txt1','txt2','txt3']);
new Prado.WebUI.TTextBox({'ID':'txt1','EventTarget':'txt1','AutoPostBack':false,'CausesValidation':true,'TextMode':'SingleLine','FormID':'ctl1'});
new Prado.WebUI.TTextBox({'ID':'txt2','EventTarget':'txt2','AutoPostBack':false,'CausesValidation':true,'TextMode':'SingleLine','FormID':'ctl1'});
new Prado.WebUI.TTextBox({'ID':'txt3','EventTarget':'txt3','AutoPostBack':false,'CausesValidation':true,'TextMode':'SingleLine','FormID':'ctl1'});
/*]]>*/
</script>
[..cut..]

The interesting part comes after this - the actions at the bottom:

Code:
{"Element.setStyle":["panel0", {"display":""}]}
{"Element.setStyle":["panel1", {"display":""}]}
{"Element.setStyle":["panel2", {"display":""}]}
{"Element.setStyle":["panel3", {"display":""}]}
{"Prado.Element.replace":["panel1", "Element.replace", null, "5f000729"]}
{"Prado.Element.replace":["panel2", "Element.replace", null, "5f000729"]}
{"Prado.Element.replace":["panel3", "Element.replace", null, "5f000729"]}
{"Prado.Element.replace":["panel0", "Element.replace", null, "5f000729"]}
{"Prado.Element.replace":[null, "Prado.Element.evaluateScript", null, "6a8ee784"]}

This code first sets the panel's 0-1 display property. Then there's a call to Prado.Element.replace. This is a wrapper around prototypes Element.replace. The first line does this:

It replaces panel1 with the content in the boundaries "5f000729" which is the HTML block from the AJAX response. That means now we have another set of panels 0-4 inserted into the DOM on the place of the previous panel1. We now already have duplicate ids for panel 0, 2 and 3. You see that this is not really what should happen. And the game goes on.

That's what i tried to say when i talked about "problems with prado's AJAX code".

I think, some wiki article that explains the whole javascript side of an AJAX callback would be helpful to analyze problems like this. I could start a basic version though i must confess, all i know about this i learned by looking at the sources.
Logged
rojaro
Senior Member
***

Karma: 22
Offline Offline

Posts: 422


PRADO aint no voodoo ...


View Profile WWW
« Reply #6 on: Feb. 20, 2008, 12:42:35 PM »

mikl,

i see your point, but then we actually have have two questions to answer:

The first would be "Why doesnt it work in FF2?" and for this part the answer you've offered seems to be correct: a bug somewhere in the Prado code that is responsible for rendering the actions. If this code gets fixed the problem goes away.

But then there is also the second question, which is IMHO much more interessting as we already know the root and the solution to the problem behind the first question (although it is not yet fixed). Yes, the symptoms will go away as soon as the code related to the first question is fixed, but why doesnt this problem affect FF3 when it uses exactly the same code?

Greetings from Hamburg / Germany
- rojaro -
« Last Edit: Feb. 20, 2008, 12:44:07 PM by rojaro » Logged

A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)
mikl
PRADO v3.x Developer
Platinum Member
*****

Karma: 51
Online Online

Posts: 733



View Profile
« Reply #7 on: Feb. 20, 2008, 12:57:03 PM »

Well, at least for me it doesn't make sense to think about problems that are not in my domain. Wink We could of course ask the FF people why the above code works in FF2 and not in FF3. The response would be "Uhm, you create invalid content. What did you expect?".

I think our main problem is how to improve Prado's AJAX code. If you take a look at the current bug list you find that there are many problems with ActiveControls - some of them essential. As it feels like the core developers ATM are too busy to fix those issues we should think about a solution.

We could try to create fixes on our own - which immediately leads to the next problem: prado's clientside javascript isn't well documented apart from comments in the source code. That makes it hard to work on bug fixes. So i think, the first step would be to create at least some appropriate API docs for prado's javascript. I've searched for some phpdoc like software that also can parse javascript but didn't find anything really useful - or was too busy to test it ou.

Maybe someone else want to share a good jsDoc solution to create API docs from source?

We then of course need a place to host it. Don't know if anyone with site access to pradosoft.com is still around here ...  Wink
Logged
Silver
Junior Member
**

Karma: 0
Offline Offline

Posts: 14


View Profile
« Reply #8 on: Feb. 21, 2008, 10:17:48 AM »

Anyway a ticket has been opened. I can live without this, so it's not a big problem to me.

mikl: Thank you for the tip using normal TPanels nested inside the activepanel.

Silver

Logged
maddin
Senior Member
***

Karma: 7
Offline Offline

Posts: 175



View Profile WWW
« Reply #9 on: Feb. 21, 2008, 11:16:44 AM »

I think, the core developers are really busy at the moment. But that's a real problem, because many bugs are open. May be, this thread is interesting for this discussion!
Logged

Greetings from Germany Wink
tof06
PRADO v3.x Developer
Platinum Member
*****

Karma: 66
Offline Offline

Posts: 733



View Profile
« Reply #10 on: Apr. 24, 2008, 09:09:40 AM »

This issue was the same than Ticket #669.
It has been fixed in 3.1.2
Logged
Pages: [1] Print 
« previous next »
Jump to: