cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul G. Joseph" <pjos...@gmail.com>
Subject how to obtain selected values in a multi-value dropdown
Date Wed, 09 Oct 2013 20:24:54 GMT
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



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


Mime
View raw message