cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamal Bhatt <kbh...@tt.com.au>
Subject Re: Getting selected values from a multvaluefield
Date Fri, 30 May 2008 00:43:21 GMT
Grzegorz Kossakowski wrote:
> Kamal Bhatt pisze:
>> Hi,
>> I would like to get all the selected values for a multi value field. 
>> When I try to interogate the values from a multi value field, I get 
>> the index, not the values.
>>
>> Here is the definition of my multi value field:
>>
> <snip/>
>>
>> Here is how I am interrogating the multi value field:
>>
>>    <fd:action id="add_images" command="add_image">
>>      <fd:label>Add</fd:label>
>>      <fd:on-action>
>>         <fd:javascript>
>>            var images = 
>> event.source.lookupWidget("../images_group/image").value;
>>         for (var image in images)
>>         {
>>            cocoon.log.error(image);
>>         }
>>         </fd:javascript>
>>      </fd:on-action>      </fd:action>
>>
>
> The problem is with for loop. Construct for .. in .. allows you to 
> iterate over methods and fields of Java object not list/map of object 
> itself. See:
> http://www.mozilla.org/rhino/ScriptingJava.html (Section Working with 
> Java objects)
>
> You need to use casual for loop for iterating over images list.
>
> PS. I find this behaviour counter-intuitive too.
>
You are correct. Thanks. I agree with you that this is counter intuitive.

-- 
Kamal Bhatt


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


Mime
View raw message