Balasubramaniam, Sezhiyan wrote:
I usually set the JavaScript add-options statements using logic-iterate and on 
the event of user clicks a button; this function will be called which will 
populate the select box.

        function refreshSelect()
        {
        <logic:iterate id="MIP_SUBGRP_CD" name="MIP_SUBGRP_CD">
document.forms[0].eligMipSubgrpCd.options[<%=y%>] = new Option('<bean:write name="MIP_SUBGRP_CD" property="description"/>','<bean:write name="MIP_SUBGRP_CD" property="code"/>');
                <%y++;%>
        </logic:iterate>
        }

You can try this. But avoid using forms[0] or the scriptlets in logic 
tags(though it works fine)

Make sure that the select is populated correctly and don't forget to select 
some item[s] before submits the form.

Bala
Thanks for your answer.

Now if I submit the form I select all the options, but I get the following error from Tomcat:

^^^^^^^^^^^^^^^^^^^^^^^^^^
javax.servlet.ServletException: BeanUtils.populate
        at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
[...]

root cause

org.apache.commons.beanutils.ConversionException: Cannot assign value of type 'java.lang.String' to property 'chosen' of type 'java.util.ArrayList'
        at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:423)
[...]
^^^^^^^^^^^^^^^^^^^^^^^^^^


'chosen' is the select I want to read.

If I don't select any item I don't get that error but of course "chosen" is empty.

The html code is:

<!-- ################################### -->
<tr>
<td style="width:200px;">
<span class="etichetta">Investimenti disponibili</span>:
<select class="transfer" name="possible" size="5" multiple>
<c:forEach var="row" items="${elencoinvestimenti}" varStatus="status">
<option value="<c:out value="${row.id}" />"><c:out value="${row.nome}" />
</option>
</c:forEach>                              
</select>
</td>
<!-- ################################### -->              
<td style="width:30px;">
<a href="javascript:copyToList('possible','chosen')">
<img src="gestione/images/icon_frecciadx.gif" width="21" height="21">
</a><br>
<a href="javascript:copyToList('chosen','possible')">
<img src="gestione/images/icon_frecciasx.gif" width="21" height="21">
</a>
</td>
<!-- ################################### -->      
<td style="width:200px;">
<span class="etichetta">Investimenti collocabili</span>:
<html:select property="chosen" size="5" styleClass="transfer" multiple="true" >
</html:select>
</td>

The firs "selct" is given; the second is populated by clicking over a button (using a javascript that put the values in the select box).

LuKe


--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Digitalpix: Il metodo più comodo, veloce e conveniente
* per stampare le tue foto digitali migliori.
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=1523&d=14-7

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

Reply via email to