0

hi,
The jsp page has multiple check boxes (retrieved from DB),....

<input type="checkbox" name="selecttype" value="<%=rs2.getString("description") %>"/>

I've read these values in to servlet page using

String[] selecttype=request.getParameterValues("selecttype");

the 'selecttype' now contains only selected checkbox values.
but i want to retrieve values of unchecked checkboxes.

Pls help me with this.
ThanQ,
Beanboy :-)

6
Contributors
7
Replies
37
Views
7 Years
Discussion Span
Last Post by vk
1

There is no way to get the values of the unchecked checkboxes because when a HTML form is submitted the values of checked checkboxes are sent to the server.

One workaround would be use hidden input fields for storing all the values

<input type="hidden" name="chkboxvalues" value="<%=rs2.getString("description") %>"/>

and in the servlet

String[] selecttype=request.getParameterValues("selecttype");
String[] chkboxvalues=request.getParameterValues("chkboxvalues");

Now use the arrays selecttype[] and chkboxvalues[] to get unchecked values

0

durgaselvam: start a new thread.
also realize: html is static. you'll need another language, jsp, jsf, .. but not html.

0

one question here is that while retrieving the value for multiple input it's not showing which is row selected. Instead it's showing all the values.

0

anubhavat: well ... duh. which is what was needed to know.
but this thread has been marked solved four years ago. no use reviving it. if you have an actual question, ask it in a new thread.

0

i have multiple checkboxes they came according to database value.... i want to save the check box value in Database(it's working) but when page reloads after submiting check box value....then i want to show which check boxes are checked ()...their valus wll come from database...any solution??? Thanx in advance

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.