Aquesta pàgina forma part de la documentació de Moodle en català, tot i que no ha estat traduïda encara. Podeu contribuir obertament a les tasques de traducció. Podeu consultar la Guia d'edició de la documentació i també participar ens els debats del fòrum de traductors de la documentació a moodle.org

Especial:Badtitle/NS100:Checkbox

De MoodleDocs
Salta a:navegació, cerca

Moodle User Interface Guidelines > Checkbox

Note: This article is a work in progress. Please use the page comments or an appropriate moodle.org forum for any recommendations/suggestions for improvement.

This is a Moodle Interface Guideline. Comments: developer forum thread


Problem

You want to know if a user wants to enable an option or not. In other words, you want an option with two choices

Context

You are designing a form.

Forces: factors that affect selection

  • Radio buttons and dropdown menus are too verbose for a binary choice
  • Dropdown menus hide the other choice

Solution

For on/off choices where there are two options,

Create a checkbox with an id attribute. Add a <label for="id_of_checkbox"> element after the checkbox. As the text content of the label element, write the result of checking the box:

[] Show me the money

Determine a reasonable default for the value: checked, or unchecked. the reasonable default should be such that if a user does not notice the option, they probably do not mind leaving it to default. If no reasonable default can be determined, you may want to consider highlighting the checkbox in the form it is in, since it is impossible to make a checkbox a required field per se.

(Another use of the checkbox is to require users to always check a checkbox, i.e. "[ ] I have read and I accept the terms and conditions", but in this case it is not really an option at all.)

Common mistakes

Do not express the option label as a question: "Do you want to see the money?"

Do not invert the option to negative voice: "Don't show me the money". Most times, only positive voice should be used.

Do not use radio buttons or dropdowns when there are only two choices.

TODO: Add further common mistakes from [1]

Examples and implementation

Some examples of good and bad implementation

Course settings (course/edit.php) - BAD: uses dropdown yes/no rather than checkbox, uses question (is this a metacourse?) Updating or adding database module (course/modedit.php?update=19&return=1) - BAD: uses dropdown yes/no for ratings and comments. Also asks question Require approval? In general, a review of each modules is needed as we have similar issues with assignment (prevent late submissions, etc.)


Related guidelines


Related issues in the tracker

MDL-19659 - Usability test: Proper display of configuration variables' default values

Further information / Sources

Alternatives to yes/no dropdown menus?