cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <>
Subject Re: [cforms] fi:validation-errors in AJAX mode
Date Fri, 05 Aug 2005 04:25:06 GMT
Sylvain Wallez wrote:
> Jason Johnston wrote:
>> Sylvain Wallez wrote:
>>> Jason Johnston wrote:
>>>> The only AJAX-related code I can find in the Widget (formmodel) 
>>>> classes is in AbstractWidget.generateSaxFragment(), where it creates 
>>>> an fi:placeholder if the widget is invisible.  It seems odd to me to 
>>>> have this here, perhaps it would better belong in the template layer 
>>>> as well.
>>> Hmm... the idea behind this is to ensure that the view layer, 
>>> whatever it is, has no possibility to produce the XML representation 
>>> of a widget if that widget's state prevents it to be displayed.
>> And that would still be the case, but the production of fi:placeholder 
>> (which is an AJAX-only implementation detail, right?) would be moved 
>> into the view layer.  Keep the "if", move the "else".
> Yes, you're right, the placeholder is only useful when in Ajax mode. Now 
> having it in at the widget level was a way to avoid to re-test again the 
> widget's state in the template, which requires to crawl up the ancestors 
> to combine their states. Efficiency for the server and lazyness for the 
> code writer ;-)

I understand the performance concern.  Turns out, though, that most of 
the JX macros are *already* re-testing the widget's visibility!  (See 
JXMacrosHelper.isVisible() which generates the fi:placeholder as a 
side-effect.)  So the "else" in AbstractWidget.generateSaxFragment() 
which creates an fi:placeholder never gets reached that I can see.  The 
redundancy should be removed one way or the other.

View raw message