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.

--
Best regards,
Grzegorz Kossakowski

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to