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
provider...
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
http://reflectingonthevicissitudes.wordpress.com/2007/04/22/pal-how-can-i-call-you/
:-)
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="http://apache.org/cocoon/templates/jx/1.0"
xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<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="${continuation.id}"/>
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")}
or:
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 Packages.java.lang.Integer(17);
form.form.getChild("add-special").addActionListener(function () {
bizData.haga = new Packages.java.lang.Integer(21);
});
form.form.getChild("argh").setValue(new Packages.java.lang.Integer(17));
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
http://reflectingonthevicissitudes.wordpress.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]