[Seaside] body attributes?

Avi Bryant avi at beta4.com
Sun Sep 19 10:48:07 CEST 2004


On Sep 19, 2004, at 10:36 AM, Andreas Nilsson wrote:

> Is there any way to alter the body attributes while rendering, ie. 
> inside renderContentOn?

No, the way it's currently structured is meant to allow the HTML 
document to be streamed out the socket, given webserver support - so by 
the time you get to rendering the content, the body attributes have 
already been sent.

> Otherwise Avi's proposed solution to getting the name of the 
> file-input:
>
> |name|
> name := html context nextKey.
> html fileInputWith...
>
> doesn't help much anymore as that's the name that I need to reference 
> from the Javascript that I'm putting in body.onLoad.

Well, probably the simplest solution is just to use a css id instead.  
But you could also add an onLoad handler from a script within the body, 
couldn't you?  Something like:

<script>
document.body.onLoad = function(){....}
</script>

Actually onLoad is generally useful enough that there should probably 
be a standard piece of JS used in Seaside for registering multiple 
onLoad actions, so that you could just do

html addOnLoadHandler: 'document.getElementById("foo").focus()'

or whatever.  Anyone have something like this kicking around?

> I need to be able to get the name first and then set the body 
> attribute and I don't have any control of when #updateRoot: is called 
> so I can't guarantee that I've got the file-input name.

I can guarantee that you don't - because of the streaming structure, 
#updateRoot: will always be called before #renderContentOn: is (and 
#updateUrl: will always be called before that).

Avi



More information about the Seaside mailing list