Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Checking Checkbox values in indexed form

 
Vili Leonardo
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a problem with checking checkbox value submitted from indexed form. The jsp displays a list of items, each list has a checkbox, so it goes like this:



Struts-config:
<form-bean name="PartItemForm" type="org.apache.struts.validator.DynaValidatorActionForm">
<form-property name="part" type="com.leonardo.oms.PartItem[]"></form-property>
</form-bean>

When this form is submitted, all the checkbox values always have "false" value even though I have selected some of the checkboxes.

I have seen these comments from the mailing list, but none helps me:
1. Have to set the checkbox in the reset() method, but In my case I don't have a form file since I defined the form declaratively in the struts-config file.
2. Use boolean type for the checkbox. PartSelected property is a boolean type.
3. Use a hidden field, then I am gonna have to use javascript to set the hidden value everytime user clicks that checkbox.

I am sure this is a pretty common web application scenarios that Struts should be able to handle.

Please give me hints on how to approach this problems.

TIA
-Vili
 
Melanie Liu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<form-property name="part" type="com.leonardo.oms.PartItem[]"></form-property>

name="part" should be changed to name="partSelected" in the above line.

But I didn't test this...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic