• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

multi check boxes in jsp

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need help getting started. I'm new at this.
I have a group of check boxes a user can select one or more protective devices listed (burglar alarm, deadbolt locks, etc.)
They all have the same name but different values.
The function to get their value is:
protectiveDevice.isDevice(int)
this returns a boolean true
How do I script to determine which check boxes where checked?
I have something so far but not sure if correct
value = "<%=protectiveDevice.isDevice(1) == true ? protectiveDevice.isDevice : false%>"
value = "<%=protectiveDevice.isDevice(2) == true ?
protectiveDevice.isDevice : false%>"
Thanks
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just conver this to script. Since only checked checkboxes will be sent to the server, this should work.
String [] checkedBoxes = request.getParameterValues("nameOfYourCheckBox");
for(int i = 0; i< checkedBoxes.length; i++)
do whatever....



------------------
Bosun
 
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic