Problem/Motivation
If no value is set for 'On/Off values' in a boolean field's field-setting, two Problems arise:
a)
The rendered field will be empty if the Display Format "Default" is used (Which is the default setting).
b)
These 'On/Off values' are used as radio-/checkbox- labels on edit forms.
So, without labels a boolean field as input widget has no label(s) that describe the selection option(s). This is a usability error. An (unexperienced) site builder is confused by the field titles and descriptions on the boolean field 'Field settings' form.
1. Add a new field of type boolean to a content type.
2. In the Field settings form, enter no 'On value' and no 'Off value'
3. Notice that in the Edit form, under 'Default values' the selection options have no label.
4. Optionally: In 'Manage form display' select the 'single on/off value' widget.
5. Create two nodes, one with this field set and one without.
6. On the node form the field's selection option(s) have no label.
7. Display both nodes: no value is displayed.
Proposed resolution
D8 fixed this by making the 'On/Off values' required, so there are always labels for the input fields, and with a custom formatting option for the field output, so one can eg. output true as 'Yes' and no output for false.
Doing the same for D7 would potentially break some sites since it's a change in logic.
Therefore a functional backport would be problematic.
Quick fix:
Change the field titles and descriptions on the boolean field 'Field settings' form, see #48
Full fix 2nd step:
Have a fallback for the input widgets if no values for the labels are configured by using 0/1(as the current help text says) or On/Off (as D8 does by default)
User interface changes
Text changes only.
Original report by jramby
Hi,
I am trying to create a view by showing a field with a boolean value. In views_ui when I try to add the default publish status field of an article content type, we can by default choose a desired output format with the values : "Yes/No", "True/False", "On/Off", "Enabled/Disabled", "✔/✖", "Published/Not published".
But with a custom boolean field we can't have these choices, We can just choose between : "Default translated", "Default", "Key", "Group subscription", We can't show anything else than 1 by selecting "Key".
In addition, when we add a filter on this same custom boolean node field, there is no possibility of choosing output format. Then in the filter dropbox there are the next values : "- Any -", "", "".
How can I provide a label to my exposed filter and my fields value.
Thank you all.