[Seaside] nested LiveCallbacks
Michel Bany
m.bany at wanadoo.fr
Fri Oct 28 08:16:45 UTC 2005
Juan Burella a écrit :
> Using this version it works in a different way but not
> completely right. When the second list is selected everything works
> fine, but then the first one is selected, it disappears leaving only
> the second and the third visible.
>
I think I can see what's wrong.
The original implementation of live update allowed for updating only one
area of the html document.
With you test case you need to live-update two areas, provinceSelector
and citySelector,
therefore the original implementation cannot work.
The implementation in Seaside2.5b8-mb.14 allows you to live-update an
arbitrary number of
areas of the html document. For detecting all the areas, i.e. all the
html tags with the id= attribute,
the new implementation uses the DOM feature of XMLHttpRequest. However,
this DOM feature
is very strict and requires that the html produced by the live update
blocks is clean XML. That's why
the new implementation sets the content-type to 'text/xml;
charset=utf-8' and replaces all occurences
of with  
Your test case introduces an additional difficulty. The html produced by
the first live update callback
creates something that contains
"/seaside/seacomp?_s=VRWSgWELJnBWLCZt&_k=PgJIHXbL'
The occurence of the ampersand (&_k=) makes this html unclean XML that
cannot be parsed
by XMLHttpRequest and the live update Javascript degrades into
displaying whatever is received
rather than selectively updating the document. Not sure I am explaining
this well.
I tried to have the ampersand encoded so that the html creates something
like
"/seaside/seacomp?_s=VRWSgWELJnBWLCZt&_k=PgJIHXbL'
With this encoding the html created becomes compliant with XML and is
properly parsed by XMLHttpRequest.
However, this does not work because the browser does not decode "&"
back to an ampersand
before sending the URL to Seaside and Seaside gets lost.
Ideas welcome.
Michel.
More information about the Seaside
mailing list