Hi,

  In the below given code I am populating the html:select property 'from'
using a
java bean. On clicking the '>>' button I am moving the selected option from
''from' to 'to' html:select using the javascript function move().

  The selected values are displayed in the 'to' html:option, but I am not
getting
the value in the Form.java function

public Integer[] getTo()
{
  return to;
}

  Any help is greatly appreciated. Thank you.

Sudheer


<%@ page language="java" session="true" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<script language="javaScript1.2">
function move( from, to )
{
  toMove = from.options[ from.selectedIndex ];
  opt = new Option( toMove.text, toMove.value, false, false );
  to.options[to.length] = opt;
  return true;
}
</script>

<html>
<body>
<html:errors />

<html:form action="/AddProduct" name="productForm"
type="com.mycart.ProductForm" scope="request">
<table width="750" border="0">
<tr>
  <td><bean:message key="app.from" /></td>
  <td></td>
  <td><bean:message key="app.to" /></td>
</tr>
<tr>
  <td colspan="1" width="320">

  <html:select property="from" style="width:300px" size="10"
multiple="true">
  <html:options collection="categories" property="id" labelProperty="name"
/>
  </html:select>
  </td>
  <td>

  <html:button property=">>" value=">>" onclick="move(from,to);return
true;"/>
  <html:button property="<<" value="<<" onclick="remove(to);return true;"/>

  </td>
  <td colspan="2" width="320">
  <html:select property="to" style="width:300px" size="10" multiple="true">
  </html:select>
  </td>

</tr>
<td colspan="2" align="center"><html:submit /><html:cancel /><html:reset
/></td>
</tr>
</table>
</html:form>
</body>
</html>

Reply via email to