aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes why are HTML checkboxes sometimes problematic for managing true/false values Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "why are HTML checkboxes sometimes problematic for managing true/false values " Watch "why are HTML checkboxes sometimes problematic for managing true/false values " New topic
Author

why are HTML checkboxes sometimes problematic for managing true/false values

Tulip Jain
Greenhorn

Joined: Nov 08, 2011
Posts: 9
Can someone explain,
why are HTML checkboxes sometimes problematic for managing true/false values via form submissions?


thanks in advance?
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

Sounds like an interview or homework question. What's your answer?

And yes, I have the answer -- but we want to hear what you think first.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Tulip Jain
Greenhorn

Joined: Nov 08, 2011
Posts: 9
Yes it was a interview question .... i couldn't hit it .....

Only thing i know is that checkboxes are used to take multiple inputs from the user in case of a form submission...
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

Tulip Jain wrote:Only thing i know is that checkboxes are used to take multiple inputs from the user in case of a form submission...

Not always. Like most other controls, you can have multiple values by giving them all the same name, but that's not an attribute of the checkbox itself.

The answer is that when a checkbox is unchecked, it does not take part in the submission at all. A value is submitted only when the checkbox is checked. So rather than checking a param for a value such as true or false, you need to check for the existence of the parameter itself.
Tulip Jain
Greenhorn

Joined: Nov 08, 2011
Posts: 9
Thank you so much ... for clearing the concept ...
 
 
subject: why are HTML checkboxes sometimes problematic for managing true/false values
 
Threads others viewed
Check Box Handling
Multiple checkboxes and Struts2
JSP values (checkbox) - True or On
No request parameter found in reset method of ActionForm
developer file tools