Make a plugin with the following parameter in the manifest:
<extension version="3.0" type="plugin" group="content" method="upgrade">
<!-- ... -->
<config>
<fields name="params">
<fieldset name="Parameters" label="Parameters">
<field name="MyCheckbox" type="checkbox" label="My Checkbox" default="0"/>
</fieldset>
</fields>
</config>
</extension>
The parameter is now not settable to checked. If you check it in the plugin's options page and save, it's 0 in the database and unchecked if you visit the plugin options again.
Hard to tell when did it break. As of Joomla 5.4.0, the default causes the <input type="checkbox"> element to have a value="0", which is wrong - when the form is submitted, the zero goes into the checkbox' name-value pair in the URL encoded form, i. e. MyCheckbox=0, so that 0 ends up being the parameter value as far as the back-end is concerned.
| Labels |
Removed:
?
|
||
| Labels |
Added:
No Code Attached Yet
|
||
| Status | New | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2025-10-31 09:10:49 |
| Closed_By | ⇒ | Fedik |
That is expected behavior, kind of.
With default value you will be unable to save unchecked checkbox, because the default value will be taken.
I would suggest to use Radio or Select instead.
All I can say, it used to work. Also, I didn't come up with default by myself - it was listed in a manifest reference at some point.
| Status | Closed | ⇒ | New |
| Closed_Date | 2025-10-31 09:10:49 | ⇒ | |
| Closed_By | Fedik | ⇒ |
Works as expected in 4.4.14. I jumped from that straight to what was under Joomla Next (5.4), so impossible to tell what it was like in earlier 5.x releases.
Notably, the <input> element on the plugin options form in J4.4.14 has value="1" in it. Not the zero from the default.
@sevaa According to the documentation, the checkbox field does not have a "default" property: https://manual.joomla.org/docs/general-concepts/forms-fields/standard-fields/checkbox/
You should use the "checked" property instead:
Could you check and report back if that works for you?