[Seaside] How would you re-write this code to hide/show content
Mike
me at mikehogan.net
Sat Jan 22 13:37:51 CET 2005
Here is one possibility:
function processRequestChange()
{
if(request.readyState == 4)
{
var results = regex.exec(request.responseText);
if(results) {
document.getElementById(results[2]).innerHTML =
results[3];
} else {
var bodyRegex = /<body>(.*)?<\/body>/;
var body =
bodyRegex.exec(request.responseText);
if ( body ) {
document.body.innerHTML = body[1];
} else {
document.body.innerHTML = request.responseText;
}
}
}
}
On Sat Jan 22 04:16:42 PST 2005, Avi Bryant <avi.bryant at gmail.com>
wrote:
> On Sat, 22 Jan 2005 04:06:06 -0800 (PST), Mike <me at mikehogan.net>
> wrote:
>> Wow, thats pretty clever! It took me some time to understand all
>> the moving parts.
>>
>> One thing: Initially I did not add renderDiv2On and renderDiv3On
>> methods, so I was not getting updates. I modified
>> WAStandardScripts to print out the contents of
>> request.responseText, and I could then see that its a
>> doesNotUnderstand debug page. Makes sense. So liveUpdate is
>> swallowing debug pages. Do you think this is correct? Would it
>> not be better if liveUpdate alerted the user if an exception page
>> comes back, or just, more generally, if the regexp did not
>> succeed?
>
> Yes, it certainly would - probably what it should do is just
> replace
> the body of the document with the resulting response. If anyone
> wants
> to submit a modification that does that, that would be great.
>
> Avi
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside
>
>
>
More information about the Seaside
mailing list