Html best input type for boolean values selection

  • In web development, html , what is the best input type to be used if users are only given two choices? basic true or false for example? active or inactive?

    my choices are: two radio buttons, dropdown lists with 'true' or 'false', textareas? (probably not).

    I'm actually confused whether it's more valueable for the users to have less clutter (dropdown) or obvious selections (radio buttons).. what's the best input type if there are only two choices?Thanks!

    it seems like you're missing the most obvious: checkboxes.

    no no.. you only have two options.. it's either true or false.not both.

    thats exactly what a checkbox is...

  • In a scenario where the user has to select simple true/false or active/inactive states then I would really suggest that you use a checkbox control rather than a control which would feature redundant input, eg:

    mockup

    In a case such as this there is no reason to add additional input controls which provides the same result as a more simple checkbox control. Either the sync is on or not, the sync being not ON is the same as the sync being OFF.

    However, there are of course cases where two alternative answers can't be provided with a simple Yes, I agree with what the checkbox label says. Such as:

    mockup

    download bmml source – Wireframes created with Balsamiq Mockups

    This would be very confusing to try and convey using a checkbox control. So it's really all about what type of question you're asking.

    But regarding whether you should use a radio button control or a dropdown for these types of questions, for a two alternative question definitely go for the radio button since that provides a better scanability of a form etc.

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM

Tags used