[Seaside] Live update (XMLHttpRequest) to update 3 dependent lists (<select>)

Yar Hwee Boon hboon at motionobj.com
Tue Feb 8 14:58:58 CET 2005


On 08-Feb-05, at PM 09:12, John Pierce wrote:

> Hi all,
>
> Yes -- this is a problem that I had to address in the LiveWeb package
> I've been working on.  Basically, some browsers (FireFox) do, in fact,
> run new script blocks that get inserted into the document.
> Unfortunately, IE does not.

That's odd, I am testing primarily with FireFox and it seems that it 
doesn't run the new script blocks. Following what you suggested, I 
added something to WAScriptLibrary>>liveUpdate so that part of it reads 
(the last 3 lines is what I added:

  function processRequestChange()
    {
        if(request.readyState == 4)
        {
            var results = regex.exec(request.responseText);
            if(results) {
                document.getElementById(results[2]).innerHTML = 
results[3];
var regexp = new RegExp(/<script>(.*)<\/script>/);
script = regexp.exec(results[3])[1];
eval(script);

This seems to work (although restricted to 1 script block, it seems 
safe for us to assume this), I'll just need to touch up a little. I'm 
hoping that we can have something that is generic enough and fast 
(since John commented that regexp is slow for his purposes) to be 
proposed to Avi for addition. Anyone suggest some changes or 
improvements?

John: How do you handle situations where the browser does execute the 
code automatically? Browser name/version check? Thanks.

--
HweeBoon
MotionObj
(65) 6764-9774



More information about the Seaside mailing list