Jason Johnston wrote:

On Tue, 2005-08-02 at 16:57 +0200, Sylvain Wallez wrote:

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.

The full page reload is triggered by a special "X-Cocoon-Ajax: continue" header. Reacting to an empty document would not work, as there are some event listeners that do nothing. For example, we may want to check the validity of an input as soon as it's entered. If the input is valid, nothing special happens and the returned document is empty.

Sylvain

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

Reply via email to