No Code Attached Yet
avatar sevaa
sevaa
30 Oct 2025

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.

avatar sevaa sevaa - open - 30 Oct 2025
avatar sevaa sevaa - change - 30 Oct 2025
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 30 Oct 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 30 Oct 2025
avatar richard67
richard67 - comment - 31 Oct 2025

@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:

checked (optional) should be set to 1 to check the checkbox by default or 0 if not.

Could you check and report back if that works for you?

avatar Fedik Fedik - change - 31 Oct 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-10-31 09:10:49
Closed_By Fedik
avatar Fedik Fedik - close - 31 Oct 2025
avatar Fedik
Fedik - comment - 31 Oct 2025

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.

avatar sevaa
sevaa - comment - 31 Oct 2025

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.

avatar Fedik Fedik - change - 31 Oct 2025
Status Closed New
Closed_Date 2025-10-31 09:10:49
Closed_By Fedik
avatar Fedik Fedik - reopen - 31 Oct 2025
avatar Fedik
Fedik - comment - 31 Oct 2025

hm, okay
last change in this field was #37174
not really see how it may affect

avatar richard67
richard67 - comment - 31 Oct 2025

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.

@sevaa Possibly I was wrong and it is just not well documented in the new developer docs.

avatar richard67
richard67 - comment - 31 Oct 2025

hm, okay last change in this field was #37174

That was released with Joomla 5.2.4 in February.

@sevaa Could you approximately say when it has stopped to work for you?

avatar sevaa
sevaa - comment - 31 Oct 2025

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.

Add a Comment

Login with GitHub to post a comment