You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Tuan H. Le" <tu...@phsadc.com> on 2002/11/05 02:54:17 UTC

Hi,

I need to pass in the select box index to a JavaScript function. Is there a way to do that in <html:multibox> tag?. I have tried JSP scripting (<%=...%>), but that does not work. I have two multiboxes in a form and I need to select/unselect the checkbox between those two multiboxes via calling my selectChoice() JS function below

JavaScript:

   function selectChoice( field, i ) {
      if ( field[i].checked == true ) {
         // unselect other check box index
      }
   }

JSP:

<logic:present ........>
  <logic:iterate id="employee" name="employeeList" ....indexId="idx" length="25" offset="<%= ""+count %>">
  	<tr>
                <td>
                  <html:multibox property="rejectList" onclick="selectChoice( this.form.rejectList, <<<<NEED TO PASS IN CHECKBOX INDEX HERE>>>> )">
                     <bean:write property="employeeId" name="employee"/>
                  </html:multibox>
                </td>
      </tr>
  </logic:iterate>
</logic:present>

Thanks,
Tuan