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

 
Kavita Ghia
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello Java Ranchers,
I have a following query and would be very happy and thankful to receive the reply:
I have a single checkbox and i want to know whether its checked or not.I need to retrieve the value in my bean where i am retreiving the form values and inserting it into the database.
The problem is unlike other form values the checkbox value gets lost.Though in the tomcat log files(where all the request parameters with their values are listed) i can see the status on.
Regards,
Kavita
 
Thomas Mcfarrow
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the checkbox isn't checked the request.getParameter("checkbox name") will return null otherwise it will return its value.
 
jorge zapata
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
another way of doing that is to use javaScript and check to see if the checkbox/radiobutton has been selected. if so, or if not you can set a hidden field on the html and read the hidden field value from the request.getParameter and then do the processing you need to do.
Hope that helps!
jz
 
Kavita Ghia
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I have used the second option what jzapata said.I was thinking of doing the same thing but just wanted to know if there is a better option.
Kavita

[This message has been edited by Kavita Ghia (edited October 03, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!