You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by tapestryphoto <ph...@digiatlas.org> on 2009/01/15 12:28:53 UTC
How to specify onUnload in ?
Hi,
I have a template component that is used by all my pages. I'd like to
be able to specify <body onUnload="..."> for one of those pages.
Unfortunately it doesn't seem to matter what way I try I cannot get it
to work.
I can't include a <body> in the page because then there will be two
such tags (Firefox doesn't mind, but IE doesn't recognise the second
body tag - plus it is poor form anyway).
I can't include onUnload in the template <body> because it appears to
just be replaced with a standard <body> tag when the page is rendered.
I can't use any form of <t:if> ... (which I would have liked to do -
passing the onUnload string into my template and then choosing a
single <body> or parameterised version depending on whether the value
was null) because <body> has to match with </body> and the </t:if> tag
obviously screws this up.
I can't use t:outputRaw to generate my tag because it won't generate
special characters properly ("<" and ">").
I don't recall having these sorts of problems with Tapestry 3 when I
used it many moons ago. It seems T5 is really rather limited in this
respect.
Is there any way to do what I want? It is rather critical that I can
perform onUnload.
thanks,
p.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: How to specify onUnload in ?
Posted by Lubor Gajda <lu...@gmail.com>.
You can observe browser events also by using prototype Event.observe
function. For instance you can use this javascript code in your page:
Event.observe(window, 'unload', function() {
// your unload actions
});
In this case you don't need direct access to html body element what will
simplify your situation.
On Thu, Jan 15, 2009 at 11:28 AM, tapestryphoto <ph...@digiatlas.org>wrote:
> Hi,
>
>
> I have a template component that is used by all my pages. I'd like to be
> able to specify <body onUnload="..."> for one of those pages. Unfortunately
> it doesn't seem to matter what way I try I cannot get it to work.
>
> I can't include a <body> in the page because then there will be two such
> tags (Firefox doesn't mind, but IE doesn't recognise the second body tag -
> plus it is poor form anyway).
>
> I can't include onUnload in the template <body> because it appears to just
> be replaced with a standard <body> tag when the page is rendered.
>
> I can't use any form of <t:if> ... (which I would have liked to do -
> passing the onUnload string into my template and then choosing a single
> <body> or parameterised version depending on whether the value was null)
> because <body> has to match with </body> and the </t:if> tag obviously
> screws this up.
>
> I can't use t:outputRaw to generate my tag because it won't generate
> special characters properly ("<" and ">").
>
>
> I don't recall having these sorts of problems with Tapestry 3 when I used
> it many moons ago. It seems T5 is really rather limited in this respect.
>
> Is there any way to do what I want? It is rather critical that I can
> perform onUnload.
>
> thanks,
> p.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>