Hi Grzegorz*,

>> - When I have the variable as form attribute I can use it in the action
>> but don't have access to it in my Jexl
>
> Are you sure? My gut feeling is that it may be not true.

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

>> - When I use cocoon.context.setAttribute() access is fine but the view
>> doesn't update the Jexl part
>
> I don't parse this sentence. What does "the view doesn't update the
> Jexl part" mean?

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.

>> Grzegorz, is this what was your Object model refactoring was/is about?
>
> YES. My work is about simplifying things so it should be always
> obvious how to access and pass various bits of data. I have not touch
> forms stuff yet, though.

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

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

Thank you very much (once more) !
Florian

###### definitions/ajax_dummy.xml #######
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition";
xmlns:i18n="http://apache.org/cocoon/i18n/2.1";>

  <fd:widgets>

      <fd:output id="argh">
            <fd:datatype base="integer"/>
        </fd:output>

        <fd:action id="doit">
            <fd:label>Do it!</fd:label>
            <fd:on-action>
                <fd:javascript>
                   
event.source.form.form.getChild("argh").setValue(Packages.java.lang.Integer(21));
                    cocoon.context.setAttribute("haga","21");
                    //cocoon.parameters.setParameter("haga","7676");
                </fd:javascript>
            </fd:on-action>
        </fd:action>
    </fd:widgets>

</fd:form>

####### 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/>
            <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.showForm("templates/ajax_dummy.xml",{bizData:bizData});
    cocoon.sendPage("success");
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to