Jeremy Quinn wrote:
I have worked around the problem by adding my bizData to the Form as an Attribute.

We need to decide which to do ....

I think I can only confirm what you already know. In Woody, we used to have access to viewData:


    <wd:field id="a">
      <wd:on-value-changed>
        <javascript>
          viewData.myBean....
        </javascript>
      </wd:on-value-changed>
    </wd:field>

If it is broken in current CForms, probably this is something which need 
fixing...

Vadim


    fix it if it is broken
    update the docs with the proper technique if it does actually work
    remove it from the docs if we don't want this functionality

regards Jeremy



On 7 Dec 2004, at 14:28, Jeremy Quinn wrote:

Sorry to bug you guys about this again, but I still have no solution.

According to the docs, I am supposed to have access to BizData sent with the sendForm function, from within CForms EventHandlers, but still cannot work out how to do it.

I am using the CForms model in :

    resource://org/apache/cocoon/forms/flow/javascript/Form.js

Form.js seems to add the bizData to the ContextObject, but I do not see how to retrieve it.

Should I be able to do this?
Or is it a bug in the code or the docs?

Thanks for any help

regards Jeremy

On 1 Dec 2004, at 19:29, Jeremy Quinn wrote:

Hi All

A little problem I cannot solve ...... and I cannot find any samples tat do this ......

Part of a form I am working on has a couple of menus.

The menu called 'group' is a list of folders grabbed dynamically from the filesystem by the flowscript that calls the form.
The menu called 'cid' is set to a list of the files in the folder chosen in "group".


<fd:field id="group" required="true">
. . .
<fd:selection-list type="flow-jxpath" list-path="groups" value-path="value" label-path="label" />
<fd:on-value-changed>
<javascript>
var value = event.source.value;
var cid = event.source.lookupWidget("../cid");
if (value != null) {
cid.setSelectionList(getComponentFiles(viewData.components, value), "value", "label");
} else {
event.source.setValue(null);
cid.setSelectionList(new Packages.org.apache.cocoon.forms.datatype.EmptySelectionList("..."));
}
cid.setValue(null);
</javascript>
</fd:on-value-changed>
</fd:field>


The function getComponentFiles needs the 'components' parameter, which is the location of the base components folder. It needs to be passed from a SiteMap parameter, so I have added it to the bizData:

form.showForm(screen, {groups:getComponentGroups(components), components:components});

I am getting errors similar to this when the form attempts to load:

    ReferenceError: "viewData" is not defined

I have used the "viewData" value in projects before, in earlier versions of CForms.

I have tried several variations, but cannot work out the correct way of getting the bizdata.

    viewData.components
    viewData["components"]
    components
etc.

If I make 'components' a global JS variable instead of passing it as bizData, I can access it fine, but I would prefer not to work that way ;)

What am I doing wrong?

Thanks for any suggestions.

regards Jeremy

Reply via email to