I'm trying to add checkbox to my template parameter and giving default="1" value to make it checked by default.

<field name="fieldname" type="checkbox" label="fieldlabel" description="Desc of the field" value="1" default="1"/>

The output indeed checked by default by it can't be unchecked. Everytime I uncheck it and save the parameter, the checkbox is always back to checked.

If I change the default value to 0 then it's working properly. Any idea how to deal with this? Thanks

1 Answer 1


This problem has been discussed on Stack Overflow, and as far as I can see there aren't any simple solutions. A couple of options are discussed, so you might be able to implement something. The OP of the question ended up creating a field override.

The problem is really a HTML shortcoming, explained here.

Submitting it, leaving empty values and not checking the checkbox, you would get the following $_POST array (notice the missing "checkbox")

array (
  "input" => "",
  "hidden" => ""

In short: <input type="checkbox" name="field" value="something"> either gets submitted as field = "something" if checked, or doesn't exist if unchecked.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.