You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Lucas Claude <cl...@thomson.net> on 2004/03/08 13:48:51 UTC

html:multibox with DynaValidatorForm reset problem

Hello, 
As I'm using html:multibox in my JSP and need to reset the selected items,
I've extended the DynaValidatorForm and written a reset() method to do this.
Although the reset() method is called, the list of selected items is never
reseted. What did I missed? Thanks for help. 
It seems the list managed by the genericForm is not the same as the one
declared in Struts-config.xml : when the check boxes are checked, I recover
them in the Action but did not see them in reset method (the string list is
always empty.) Also , getSelectedItems and setSelectedItems are never called
I tried not to declare selectedItems in Struts-config.xml but an error tells
there is no getter method for property selectedItems..... 
ANNEX : Struts-config.xml :
 <form-bean name="genericForm" type="project.transmissionGenericForm"
dynamic="true">
      <form-property name="selectedItems" type="java.lang.String[]" />
 </form-bean>
Action Form : 
public final class genericForm extends DynaValidatorForm
{
    String[] selectedItems = {};

    public String[] getSelectedItems()
    {
    	return (this.selectedItems);
    }

    public void setSelectedItems(String[] _selectedItems)
    {
        this.selectedItems = _selectedItems;
    }

    public void reset(ActionMapping mapping, HttpServletRequest request)
    {
       if ( this.selectedItems != null )
       {
          String[] empty = {};
          this.selectedItems = empty;
      }
    }
JSP : (mutlibox are not attached to calls list !) 
<logic:iterate name="genericForm" id="calls" property="calls"
type="clients.ConnectionExt" offset="offset" length="length">
  <tr>
    <%  String valueId = String.valueOf(calls.getId());%>
    <td>

    .....etc.
    </td>
    <td bgcolor="#C9DBF1" width="34">
        <html:multibox name="genericForm" property="selectedItems"
value="<%=valueId%>" ></html:multibox>
    </td>
<tr
.... 



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org