Boolean type field works in add forms, but not in edit forms. This is partially because forms rely on JS new Formdata() which ignores unchecked checkboxes, but also needs a way to interpret unchecked value true as false. The code intended to handle checkboxes does not currently provide a solution for Boolean type fields.
For an example of a boolean field front-end implementation, see here, value “true” checkbox:
<fieldset class="w-full">
<legend class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300">{{label}}</legend>
<div {{attributes}} class="boolean {{validation}} flex items-center mb-4">
<input {{attributes}} {% if value == true or value == "true" %}checked{% endif %} class="w-4 h-4 text-info-600 bg-gray-100 rounded border-gray-300 focus:ring-info-500 dark:focus:ring-info-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600" type="checkbox" name="{{name}}" id="{{name}}_true" value="true">
<label class="ml-2 text-sm font-medium text-gray-900 dark:text-gray-300" for="{{name}}_true">true</label>
</div>
</fieldset>
Intended behaviour should be that checked boolean sets value true, and unchecked value false. Currently checked sets value true, but unchecked is left out of form submission, so works on a new item create to leave null, but doesn’t ever set to false.
Please authenticate to join the conversation.
Backlog
Feature
9 months ago

Matt Jones
Get notified by email when there are changes.
Backlog
Feature
9 months ago

Matt Jones
Get notified by email when there are changes.