• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Checking Checkbox values in indexed form

Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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:

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

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.

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
    Bookmark Topic Watch Topic
  • New Topic