• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

checkbox

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
I like tacos! And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic