cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <jason.johns...@Intrado.com>
Subject Re: [cforms] fi:validation-errors in AJAX mode
Date Tue, 02 Aug 2005 15:18:07 GMT
On Tue, 2005-08-02 at 16:57 +0200, Sylvain Wallez wrote:
> Jason Johnston wrote:
> 
> > Sylvain Wallez wrote:
> >
> >> Jason Johnston wrote:
> >>
> >>> 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.

Right, I meant that when the javascript makes an AJAX request (with the
cocoon-ajax header set), it checks the response for the existence of any
bu:replace elements, and if none are present it allows the HTML to
submit the form normally so the flow can continue.  But if you were to
manually insert a bu:replace in the template, that would mean that the
response to each AJAX request would always contain that bu:replace, so
you'd never get the empty document.

Anyway, getting off-topic.

> 
> >>> 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!

Will do!

For my information, once I have a patch together what's the best way to
get it out there for community review?  Should I open a Bugzilla entry
and attach it there?


Mime
View raw message