Dev at weitling pisze:
Hi,

in an on-action-javascript in my forms definition I want to get access
to the bizData provided with the showForm()-function.
In the end I want to be able to change the entries in a selection list
on an ActionEvent. What I have so far:

    var selist = new Packages.java.util.ArrayList();
    selist.add(new Packages.demo.SelistTupel("deutsch","de"));
    selist.add(new Packages.demo.SelistTupel("english","en"));
    selist.add(new Packages.demo.SelistTupel("francaise","fr"));
var form = new Form("definitions/test2.xml");
    form.showForm("templates/test2.xml",{"selist":selist});


My definition:

    <fd:field id="mySelectionList">
        <fd:datatype base="string"/>
        <fd:selection-list type="flow-jxpath" list-path="selist"
value-path="value" label-path="label" nullable="true" null-text="-- no
selection --"/>
    </fd:field>
<fd:action id="changeSelectionListButton">
        <fd:label>Do it!</fd:label>
        <fd:on-action>
            <fd:javascript>
                // manipulate the "selist" object used by the selection-list
                // :-?
            </fd:javascript>
        </fd:on-action>
    </fd:action>

Help, I have no clue at the moment...
Thx,
Florian

In fd:javascript you have access to Form object, right? Form has attributes[1] that can hold any object you like. You can set your bizData object as attribute and get it in <fd:javascript/>.

I know that this does not answer your question "How to access bizData in <fd:javascript>?" but it gives you a solution. I would also agree that it's unnecessary complicated and one should just be able to access his bizData everywhere it makes sense.
My current work is about simplifying data access in Cocoon, so you can expect 
improvements in this area very soon.

[1] 
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/formmodel/AbstractWidget.html#getAttribute(java.lang.String)

--
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/

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

Reply via email to