germess
asked on
Struts indexed checkbox problem
Hi Experts,
I am using struts checkbox with indexed=true and also I am trying to pass the current index into the checkbox's onclick function. However, my JSP does not compile because it can't recognize the index
Could you help me with that?
<logic:iterate id="stepVO" name="manageStepForm" property="stepList" indexId="rowNum">
<td align="center" class="CUIFData">
<html:checkbox name="stepVO" property="rmisFlag" indexed="true" value="<%= valRmis%>" onclick="setChangedStatus( <bean:writ e name="rowNum" scope="page"/>)"/>
</td>
</logic:iterate>
I am using struts checkbox with indexed=true and also I am trying to pass the current index into the checkbox's onclick function. However, my JSP does not compile because it can't recognize the index
Could you help me with that?
<logic:iterate id="stepVO" name="manageStepForm" property="stepList" indexId="rowNum">
<td align="center" class="CUIFData">
<html:checkbox name="stepVO" property="rmisFlag" indexed="true" value="<%= valRmis%>" onclick="setChangedStatus(
</td>
</logic:iterate>
You can't put a <bean:write> tag inside the <html:checkbox> tag.
Try the following:
<logic:iterate id="stepVO" name="manageStepForm" property="stepList" indexId="rowNum">
<td align="center" class="CUIFData">
<html:checkbox name="stepVO" property="rmisFlag" indexed="true" value="<%= valRmis%>" onclick="setChangedStatus( <%=rowNum. toString() %>)"/>
</td>
</logic:iterate>
Regards,
Boon Leng
Try the following:
<logic:iterate id="stepVO" name="manageStepForm" property="stepList" indexId="rowNum">
<td align="center" class="CUIFData">
<html:checkbox name="stepVO" property="rmisFlag" indexed="true" value="<%= valRmis%>" onclick="setChangedStatus(
</td>
</logic:iterate>
Regards,
Boon Leng
ASKER
Boon Leng,
thanks for your response.
Unfortunately, the suggestion did not work. My page compiles with this line, but onclick="setChangedStatus( <%=rowNum. toString() %>)" does not get translated.
If I look at the Source of the page the value that gets passed into this function looks like : setChangedStatus(<%=rowNum .toString( )%>)
Any suggestions?
thanks for your help!!!
thanks for your response.
Unfortunately, the suggestion did not work. My page compiles with this line, but onclick="setChangedStatus(
If I look at the Source of the page the value that gets passed into this function looks like : setChangedStatus(<%=rowNum
Any suggestions?
thanks for your help!!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks!
let me try ...
let me try ...
ASKER
Boonleng,
thanks for your help!
Worked great, except I had to define the variable first like this:
<%
String onclick= "setChangedStatus(" + rowNum.toString() + ")";
%>
<html:checkbox name="stepVO" property="rmisFlag" indexed="true" value="<%= valRmis%>" onclick="<%=onclick%>"/>
Thanks for your help!
thanks for your help!
Worked great, except I had to define the variable first like this:
<%
String onclick= "setChangedStatus(" + rowNum.toString() + ")";
%>
<html:checkbox name="stepVO" property="rmisFlag" indexed="true" value="<%= valRmis%>" onclick="<%=onclick%>"/>
Thanks for your help!
Try the following:
<logic:iterate id="stepVO" name="manageStepForm" property="stepList" indexId="rowNum">
<td align="center" class="CUIFData">
<html:checkbox name="stepVO" property="rmisFlag" indexed="true" value="<%= valRmis%>" onclick="setChangedStatus(
</td>
</logic:iterate>
Regards,
Boon Leng