• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 856
  • Last Modified:

Multiple checkboxes in a dynamic table

I dyanmic table that creates checkbox for each row. the checkbox 'value="<%=j%>" identified by the number of a counter (integer) used in a while loop that creates the table.

Selecting the checkbox returns a null for request.getParameter("nameofCheckbox");

How can I resolve this?
0
VbMonk
Asked:
VbMonk
1 Solution
 
sompol_kiatkamolchaiCommented:
If you use multiple checkbox with the same name, you must use this

String[] multi = request.getParameterValues("nameOfChekcBox");
0
 
VbMonkAuthor Commented:
Thanks for the reply but the form is returning an JasperException and java.lang.NullPointerException
when i tried your solution. What could be the problem.
0
 
archrajanCommented:
for checkboxes unless the check box is checked it will not be passed on the jsp server side
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sompol_kiatkamolchaiCommented:
it will return null. if no checking.
0
 
VbMonkAuthor Commented:
How do i check for this exception here:
org.apache.jasper.JasperException: For input string: ""
which comes up if the checkbox has nothing in it?

0
 
neo4j4v4Commented:
Why dont you use a Java Script to check if atlease one Checkbox has been selected, before submitting?
Some code on this terms:
   if (document.formname.fieldname.checked == false &&
         document.formname.fieldname.checked == false &&
       document.formname.fieldname.checked == false) {
        
       alert("Please select at least one checkbox.\n");
       return false;
     }
 

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now