how to obtain selected values in a multi-value dropdown

"Paul G. Joseph" <[email protected]>
Newsgroups gmane.text.xml.cocoon.user
Message-ID <[email protected]>
Hi there,

I am using Cocoon 2.1.11 and CForms/Javascript/Java in Tomcat.

In a form (say myform.xml) I have two fields--both dropdowns.  One is 
multi-select, the other not.

The multiselect field is as below:

<fd:multivaluefield id="MULTI" required="false">
<fd:datatype base="string"/>
<fd:selection-list>
<fd:item value="Cat"/>
<fd:item value="Dog"/>
<fd:item value="Mouse"/>
</fd:selection-list>
       <fd:on-value-changed>
           <javascript>
           debug("Came here 1");
               var value = event.source.value;
           debug("value is: " + value);
           </javascript>
       </fd:on-value-changed>
</fd:field>

The other (no multi-select) is as follows:

<fd:field id="SINGLE" required="false">
<fd:datatype base="string"/>
<fd:selection-list>
<fd:item value="Lion"/>
<fd:item value="Tiger"/>
<fd:item value="Bear"/>
</fd:selection-list>
       <fd:on-value-changed>
           <javascript>
           debug("Came here 2");
               var value = event.source.value;
           debug("value is: " + value);
           </javascript>
       </fd:on-value-changed>
</fd:field>

Then in my log, when I select multiple values (say Cat and Mouse) in the 
first and a single value (say Tiger) in the second I get:
10/09/2013 16:16:00 PM: DEBUG: Came here 1
10/09/2013 16:16:00 PM: DEBUG: value is: [Ljava.lang.Object;@8c3fe4
10/09/2013 16:16:00 PM: DEBUG: Came here 2
10/09/2013 16:16:00 PM: DEBUG: value is: Tiger

Question: how do I get the actual values that the user chose (say Cat 
and Mouse) in the multi-value field?  Should I use a different method 
than the one I used for the single select field and which seems to work?

Paul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.