cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: [cforms] fi:validation-errors in AJAX mode
Date Tue, 02 Aug 2005 14:57:50 GMT
Jason Johnston wrote:

> Sylvain Wallez wrote:
>
>> Jason Johnston wrote:
>>
>>> On Mon, 2005-08-01 at 16:38 +0200, Sylvain Wallez wrote:
>>>  
>>>
>>>>> ? The <fi:validation-errors> element is  described here:  
>>>>> http://cocoon.apache.org/2.1/userdocs/forms/xslt.html#fi%3Avalidation-

>>>>> errors
>>>>>     
>>>>
>>>>
>>>> Yes, sure. Where I'm lost is about knowing *what* produces this 
>>>> fi:validation-errors element (it's not a widget, isn't it?). I 
>>>> never used it, and a quick search did not revealed how it is produced.
>>>>   
>>>
>>>
>>>
>>> You are correct, it is not "produced" by anything besides the template
>>> author.  It's simply a styling hint, much like fi:group, which is
>>> handled entirely by the XSLT.
>>>  
>>>
>>
>> Ok, I see.
>>
>>> Unfortunately this means that it is never included in the AJAX browser-
>>> update XML since there's nothing to ensure it's wrapped in a 
>>> <bu:update>
>>> element.  (Hmm, would manually wrapping it in a <bu:update> in the
>>> template do the trick?  I wonder.
>>>
>>
>> Yes, wrapping it with a <bu:update> would definitely update it. But 
>> that would occur at each and every form roundtrip.
>
>
> I see.  So I guess that would make it so that you could never exit 
> AJAX mode, since there would always be at least one <bu:replace> in 
> the returned XML!  Yikes.


Nono, this is smarter than that! An Ajax request is identified by the 
special "cocoon-ajax" parameter. If this parameter is not present, the 
BUTransformer simply remove the bu:replace elements. This is what allows 
the same processing chain (except the final serializer) to be used for 
Ajax and non-Ajax requests.

>>> I think there's a definite usefulness in having it
>>> AJAX-enabled, so perhaps it needs to be handled further upstream, e.g.
>>> in FormsTemplateTransformer.  Should it become an ft-namespaced element
>>> instead like <ft:validation-errors id="someId" />?  Thoughts?  I'm
>>> willing to take a whack at putting together a patch, with guidance.
>>>  
>>
>>
>> AFAIU its purpose, that would be a widget that collects validation 
>> errors from a set of other widgets. Its validate() method would check 
>> the if the collected validation errors have changed, and if yes 
>> trigger the page refresh.
>
>
> So you're suggesting to actually make it a widget, as in 
> fd:validation-errors, rather than just a template element?  That's an 
> interesting idea... I think I'd rather keep it limited to the 
> templating layer though, since it's really a presentation concern.


Ok. Tell us about your progress!

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Mime
View raw message