cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Wyles <...@robinwyles.com>
Subject Re: CForms - load / save to different targets
Date Fri, 24 Sep 2004 10:12:04 GMT
Jorg,

On 24 Sep 2004, at 11:01, Jorg Heymans wrote:

>> <fb:value id="widget" path="context1" direction="load"/>
>> <fb:value id="widget" path="context2" direction="save"/>
>
> this does not seem to work for me (using javascript binding becaues of 
> multivaluefield)
>
> the loading works but in the saving it says that it "can't create path 
> /selectedGroups" although there *is* a selectedGroups member var 
> (Arraylist) with proper get and set methods for it.
> Does the context of the load binding change the global context maybe 
> so i need to make my save binding relative to the load (tried that 
> actually without success)
>
>   <fb:javascript id="targetgroups" path="profile/baseTargetGroups" 
> direction="load">
>     <fb:load-form>
>      var collection = jxpathPointer.getNode();
>      widget.setSelectionList(collection, "id", "name");
>     </fb:load-form>
>   </fb:javascript>
>
>   <fb:javascript id="targetgroups" path="selectedGroups" 
> direction="save">
>     <fb:save-form>
>       var formValue = widget.getValue();
>       var collection = new java.util.ArrayList();
>       for(var i=0; i&lt;formValue.length; i++) {
>         collection.add(new java.lang.Integer(formValue[i]));
>       }
>       var node = jxpathPointer.getNode();
>       node.setValue(collection);
>       //tried this with jxpathPointer.setValue(collection) as well
>     </fb:save-form>
>
>

Maybe try:

   <fb:javascript id="targetgroups" path="." direction="save">
     <fb:save-form>
       var collection = new java.util.ArrayList();
       collection  = widget.getValue();
       var bean = jxpathPointer.getNode();
       bean.setSelectedGroups(collection);
     </fb:save-form>

I always have better luck with the path set to the bean context, and 
then access its own getters and setters directly.

Robin


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message