You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Eric Rogers <pu...@gmail.com> on 2008/08/01 01:07:13 UTC

Calling Javascript after updating a Zone

Hello All,

Using Tapestry 5.0.13.

I have a form, which has a corresponding zone to update when it is
submitted.  I am returning a block from the action handler for the form
submission to update the content of the zone with.  This works as expected.
However, I am wondering if Tapestry has a built-in hook that would allow the
calling of additional Javascript once the zone has been updated.

Any thoughts?

Thanks,

Eric

Re: RES: Calling Javascript after updating a Zone

Posted by Eric Rogers <pu...@gmail.com>.
Thanks for the feedback, very much appreciated.  I would like to keep my
Javascript and HTML as separate as possible, hence the less inline
Javascript the better.  I have looked through the tapestry.js script and
noticed that after a zone is updated with the content from the AJAX
response, the success handler calls the Tapestry.processScriptInReply
function.  It appears that this function checks for and evaluates a script
property in the response JSONObject that it receives.

Given that I am returning a Block from my event listener, I am wondering if
there is any way to set this script property so that Tapestry will include
it in the JSONObject it sends back with the rendered markup from the Block
component.

Any thoughts?

Eric




On Sun, Aug 3, 2008 at 5:59 PM, Andreas Pursian <dg...@gmx.net> wrote:

> Hi Eric,
>
> why not call the javascript at the end of the corresponding block element
> like this ...
>
>        <t:zone t:id="exampleZone"/>
>        <t:block id="exampleBlock">
>
>              .... some content .....
>
>                <script type="text/javascript">
>                        showexampleWindow();
>                </script>
>        </t:block>
>
> cheers!
>
> andreas
>
> -------- Original-Nachricht --------
> > Datum: Thu, 31 Jul 2008 22:06:01 -0300
> > Von: "Thiago Henrique de Carvalho" <ka...@gmail.com>
> > An: "\'Tapestry users\'" <us...@tapestry.apache.org>
> > Betreff: RES: Calling Javascript after updating a Zone
>
> > Hi there,
> >
> > Thought not exactly what you asked, in Tapestry 4 I use to do this by
> > adding
> > JavaScript code to a Block or Component's html scope, so when it is
> > updated
> > via AJAX the code runs and may call other functions already loaded in the
> > page.
> >
> >
> > Thiago
> >
> >
> > -----Mensagem original-----
> > De: Eric Rogers [mailto:puckgrabber@gmail.com]
> > Enviada em: quinta-feira, 31 de julho de 2008 20:07
> > Para: users@tapestry.apache.org
> > Assunto: Calling Javascript after updating a Zone
> >
> > Hello All,
> >
> > Using Tapestry 5.0.13.
> >
> > I have a form, which has a corresponding zone to update when it is
> > submitted.  I am returning a block from the action handler for the form
> > submission to update the content of the zone with.  This works as
> > expected.
> > However, I am wondering if Tapestry has a built-in hook that would allow
> > the
> > calling of additional Javascript once the zone has been updated.
> >
> > Any thoughts?
> >
> > Thanks,
> >
> > Eric
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
>
> --
> Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
> Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: RES: Calling Javascript after updating a Zone

Posted by Andreas Pursian <dg...@gmx.net>.
Hi Eric,

why not call the javascript at the end of the corresponding block element like this ...

        <t:zone t:id="exampleZone"/>
     	<t:block id="exampleBlock">
     		
              .... some content .....

     		<script type="text/javascript">
     			showexampleWindow();
     		</script>
     	</t:block>

cheers!

andreas 

-------- Original-Nachricht --------
> Datum: Thu, 31 Jul 2008 22:06:01 -0300
> Von: "Thiago Henrique de Carvalho" <ka...@gmail.com>
> An: "\'Tapestry users\'" <us...@tapestry.apache.org>
> Betreff: RES: Calling Javascript after updating a Zone

> Hi there,
> 
> Thought not exactly what you asked, in Tapestry 4 I use to do this by
> adding
> JavaScript code to a Block or Component's html scope, so when it is
> updated
> via AJAX the code runs and may call other functions already loaded in the
> page.
> 
> 
> Thiago
> 
> 
> -----Mensagem original-----
> De: Eric Rogers [mailto:puckgrabber@gmail.com] 
> Enviada em: quinta-feira, 31 de julho de 2008 20:07
> Para: users@tapestry.apache.org
> Assunto: Calling Javascript after updating a Zone
> 
> Hello All,
> 
> Using Tapestry 5.0.13.
> 
> I have a form, which has a corresponding zone to update when it is
> submitted.  I am returning a block from the action handler for the form
> submission to update the content of the zone with.  This works as
> expected.
> However, I am wondering if Tapestry has a built-in hook that would allow
> the
> calling of additional Javascript once the zone has been updated.
> 
> Any thoughts?
> 
> Thanks,
> 
> Eric
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org

-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RES: Calling Javascript after updating a Zone

Posted by Thiago Henrique de Carvalho <ka...@gmail.com>.
Hi there,

Thought not exactly what you asked, in Tapestry 4 I use to do this by adding
JavaScript code to a Block or Component's html scope, so when it is updated
via AJAX the code runs and may call other functions already loaded in the
page.


Thiago


-----Mensagem original-----
De: Eric Rogers [mailto:puckgrabber@gmail.com] 
Enviada em: quinta-feira, 31 de julho de 2008 20:07
Para: users@tapestry.apache.org
Assunto: Calling Javascript after updating a Zone

Hello All,

Using Tapestry 5.0.13.

I have a form, which has a corresponding zone to update when it is
submitted.  I am returning a block from the action handler for the form
submission to update the content of the zone with.  This works as expected.
However, I am wondering if Tapestry has a built-in hook that would allow the
calling of additional Javascript once the zone has been updated.

Any thoughts?

Thanks,

Eric


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org