cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Maddy <>
Subject Re: binding framework and multivaluefields
Date Wed, 29 Mar 2006 22:29:42 GMT
Sweet, thanks Simone and Bruno!  That fixed it.

I'm sending this to the development list too in hopes that someone there 
will know how to update the 'API notes' section of the following page:

Here's the line that ended up working for me:
var values = 

Thanks again!

Bruno Dumon wrote:

>In addition to this, since your multivaluefield uses "long" as datatype,
>you should use java.lang.Long, not java.lang.Integer.
>On Tue, 2006-03-28 at 22:18 +0200, Simone Gianni wrote:
>>Hi Brian,
>>i think java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 0); 
>>generates an array of int ( 
>> ), 
>>while the multivalued field probably needs an array of Integer, since 
>>internally it gets converted to an Object[] array. Maybe with java 1.5 
>>this would be managed by automatic boxing, but i would recommend to use 
>>an array of Integer.
>>This means writing something like var values = 
>>java.lang.reflect.Array.newInstance(java.lang.Integer.class, 0); (not 
>>sure this works perfectly in javascript, otherwise use 
>>Class.forName('java.lang.Integer') instead of java.lang.Integer.class).
>>Hope this helps,
>>Brian Maddy wrote:
>>>Does anyone know how to use the binding framework to set a 
>>>multivaluefield?  My XML file has a string that is comma separated 
>>>values that I need to load in, but I can't even get a simple array to 
>>>work.  Here's what I have so far:
>>>Form Definition:
>>>       <fd:multivaluefield id="unit_type">
>>>           <fd:datatype base="long">
>>>           </fd:datatype>
>>>           <fd:label>Unit Type(s):</fd:label>
>>>           <fd:selection-list>
>>>               <fd:item value="1">
>>>                   <fd:label>value 1</fd:label>
>>>               </fd:item>
>>>               <fd:item value="2">
>>>                   <fd:label>value 2</fd:label>
>>>               </fd:item>
>>>               <fd:item value="3">
>>>                   <fd:label>value 3</fd:label>
>>>               </fd:item>
>>>           </fd:selection-list>
>>>       </fd:multivaluefield>
>>>Form Binding:
>>>   <fb:javascript id="unit_type" path="dev:bldg_amenities" 
>>>       <fb:load-form>
>>>var values = 
>>>java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 0);
>>>//values[0] = 1;
>>>//values[1] = 2;
>>>//values[2] = 3;
>>>       </fb:load-form>
>>>   </fb:javascript>
>>>If I set the values variable to null, the form displays correctly, so 
>>>everything else seems to be working.
>>>Anyone know how to do this?

View raw message