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 Re: reaching viewData in a CForms event handler
Date Tue, 07 Dec 2004 14:28:21 GMT
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
>
>
> --------------------------------------------------------
>
>                   If email from this address is not signed
>                                 IT IS NOT FROM ME
>
>                         Always check the label, folks !!!!!
> --------------------------------------------------------
>
--------------------------------------------------------

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

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


Mime
View raw message