Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

checkbox  RSS feed

 
arpit singla
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when user adds books to cart in online book store, books are displayed with checkbox in front of every book. There is a Remove button at the bottom. I want to remove all the books checked after user clicks Remove button. But i am able to remove only the first book added to the form.
For this i have dynamic checkbox name and dynamic checkbox value.
<% int count = 0; %>
while {
<! -- code -->
<% String countvalue = Integer.toString(count); %>
<% out.println(" the value is " + countvalue + shopelement1.sku);%>
<td align="center"><input type="checkbox" name="<%= countvalue%>" value="<%= shopelement1.sku%>"></td>
<% count++;%>
<% } %>
On server side, i am not able to extarct the value of countvalue properly.. using request.getParameter("countvalue");
I dont know if this is the right way to do it.. please let me know if its ok this way.
 
shri ganesh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Arpit,
if i get ur problem right..u need to remove the books that are checked from the cart when Remove button is clicked....why should u go to the server for that...can u not do it on the client side using javascript unless u have already written to the database.
hope i understood ur problem right....reply if u have any clarifications!!
bye
shrig
 
saurabh pathak
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi arpit,
u definitely have to use client side java script for it
because their is no other way to capture value on client side
so write one function to get count value on client and then finally collect it on server.

thanks
saurabh
 
arpit singla
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks saurabh and shri
i will try using javascript. didn't think about that.
thanks a lot again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!