• 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

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

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone explain,
why are HTML checkboxes sometimes problematic for managing true/false values via form submissions?


thanks in advance?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Tulip Jain
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much ... for clearing the concept ...
 
reply
    Bookmark Topic Watch Topic
  • New Topic