cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Kossakowski <>
Subject Re: Using Variables/attributes in CForm/Ajax/Jexl
Date Sun, 05 Aug 2007 13:47:25 GMT
Dev at weitling pisze:
> Hi Grzegorz*,

Hi Florian, sorry for long delay. Yes, I'm busy with GSoC work and my ISP makes everything
what's possible to start wondering about another 

> I tried it with the code attached below. I hope it's not stripped down
> too much.

After looking at the code now I know what you meant. I'll post my comments below.

> Beware when I start speak Klingon ;-) I mean with Jexl everything with
> ${foo} according to the Cocoon docs. In the first run my Jexl expression
> is un as expected, in the second run (caused by the Ajax call) it might
> by called but it's not part of the update.

AFAIR, context object has "request" scope so it's recreated every time browser makes new request.
Your results are expected, but there is a 
solution (see below).

> Grzegorz, you are still my hero (cutting heads off the Hydra) :-)
> BTW: How's your name pronounced?

Hehe, have a look at

> Another question: Do you know a way to call a client-side javascript
> when an Ajax call returns?

Unfortunately not. I guess you would have to register some kind of event handler but I'm really
not ruling on client side, especially when 
it comes to the whole AJAX thing.

> ####### templates/ajax_dummy.xml #######
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <html xmlns:jx=""
>     xmlns:ft=""
>     xmlns:fi=""
>     xmlns:i18n="">
>     <jx:import
> uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
>     <body>
>         <ft:form-template action="ajax_dummy" method="POST" ajax="true">
>             <input type="hidden" name="continuation-id"
> value="${}"/>
>             widget: <ft:widget id="argh"/>
>             <br/>
>             contxt: ${cocoon.context.getAttribute("haga")}
>             <br/>
>             bzData: ${bizData.haga}
>             <br/>
>             parmtr: ${cocoon.parameters.getParameter("haga")}
>             <br/>

What about:

     form attribute: ${form.getAttribute("fatcat")}


     widget attribute: ${widget.getAttribute("fatcat")}

Of course you must set this attribute in flowscript.

>             <ft:widget id="doit"/>
>         </ft:form-template>
>     </body>
> </html>
> ######## flow ########
> function doAjax_dummy () {
>     var form = new Form("definitions/ajax_dummy.xml");
>     cocoon.context.setAttribute("haga","huga");
>     var bizData = new Object();
>     bizData.haga = new;
>     form.form.getChild("add-special").addActionListener(function () {
>         bizData.haga = new;
>     });
>     form.form.getChild("argh").setValue(new;

  form.form.setAttribute("fatcat", "That cat is really fat!");

>     form.showForm("templates/ajax_dummy.xml",{bizData:bizData});
>     cocoon.sendPage("success");
> }

I hope that attributes will work for you. In a fact, I believe there were invented to handle
exactly such cases as yours.

Grzegorz Kossakowski

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message