Hi ,
I have a JSP page where i have few checkboxes and i have disabled few of them usign javascript for certain conditions.
When i fetch the value from checkbox using request.getParameterValues("CheckBoxName"); , then do i get the values from disabled checkboxes too or disabled checkboxes are not considered by java when we fetch value?
Here is the code , checkbox with id s1 and s2 are dibaled using javascript

<form action="booking_cnf" method="post">
<!--  checkbox id is same as the value of SeatNo in the database -->
<!--  checkbox with id=1 and id=2 are disabled using javascript -->
<input type="checkbox" id="s1" name="seat" value="s1">
<input type="checkbox" id="s2" name="seat" value="s2">
<input type="checkbox" id="s3" name="seat" value="s3">
<input type="checkbox" id="s4" name="seat" value="s4">
<input type="hidden" name="doj" value="<%=doj%>">
<input type="hidden" name="BusNo" value="<%=BusNo%>">
<input type="submit" value="book">

Now the action class or model has the followind code

String BookSeats[] = request.getParameterValues("seat");
  if(BookSeats !=null){

      for(int i=0; i<BookSeats.length; i++){
          //here i will insert the seats in database which are selected in checkboxes

Can i do this ?
I am confused , what happends with the disabled checkboxes?

Please Help

Edited by prnjn

3 Years
Discussion Span
Last Post by GliderPilot

Disabled check boxes to not send their data on POST. Few alternatives:

1) Keep a hidden element with the check boxes with the same value.
2) Use javascript to enable all the check boxes on submit before the data is sent so they are included
3) Use CSS and JS to emulate a disabled box (prevent default event) without actually disabling them

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.