cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@media.demon.co.uk>
Subject reaching viewData in a CForms event handler
Date Wed, 01 Dec 2004 19:29:53 GMT
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


--------------------------------------------------------

                   If email from this address is not signed
                                 IT IS NOT FROM ME

                         Always check the label, folks !!!!!
--------------------------------------------------------

Mime
View raw message