Questions much like this have been asked many times, so I would recommend
that you check the list archives for a complete answer:
 http://archives.java.sun.com/jsp-interest.html

For a short answer, no, there is no way to capture unchecked boxes.  There
is another solution though: name each checkbox differently, and create a
hidden companion for each one.  Example:
<input type="checkbox" name="bob" value="true">
<input type="hidden"     name="bob" value="false">

Then on the receiving end:
String[] values = request.getParameterValues();
String bob = values[0];

The hidden will always be submitted, so if "bob" is not checked the value
will be "false", if "bob" is checked the value will be "true".

If you want all three checkboxes to have the same name, I don't believe
there is a solution to your problem.

Lance Lavandowska
http://www.brainopolis.com

----- Original Message -----
From: "Shamshad Alam" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 07, 2002 12:40 PM
Subject: Reading Check Boxes


> Dear All Hi-Tech-Minds
> I am using 3 checkboxes in an HTML form and initially all are checked
with
> values "Y". A JSP page reads these values by using
> ' String Array[] = rquest.getParameterValues("Checks") '
> When all the checkboxes are checked the array contains 3 elements whose
> values are all "Y" .. But if any of the checkboxes in any order is
> UNCHECHED the array contains only those values which are checked and no
> value at all for the unchecked one. Is there any way to capture a
> different value of unchecked boxes in the same array?
> Looking forward to get your help.
> Thank you.
> --Shamshad Alam

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to