When using a form field in an extension, you can normally define a default value, for example with a radio button:

<field name="something" type="radio" class="btn-group" default="1" label="Something">
    <option value="0">JOFF</option>
    <option value="1">JON</option>

This will ensure that the second option is automatically checked.

Now, I am using the checkboxes form field like so:

<field name="something" type="checkboxes" default="0" multiple="true" label="Something">
    <option value="0">Val 0</option>
    <option value="1">Val 1</option>
    <option value="2">Val 2</option>
    <option value="3">Val 3</option>
    <option value="4">Val 4</option>

As you can see, I've used default="0" which auto checks the first checkbox.

However I'd like to have all of them checked by default.

I've tried comma separating the default values and also tried a json string but with no avail.

If this possible by default or would I need to create an override for the checkboxes layout?

1 Answer 1


Set a comma separated property "checked" in the XML file rather than using default and you should be good. We also do not call trim on the comma separated values as having spaces in values is allowed by the W3C spec. So ensure there are no surplus spaces :)

  • 2
    Ah, yup that works. Cheers mate. Just a note that the comma separated values must not have a space. e.g this will not work: checked="bold, italic" but this will checked="bold,italic"
    – Lodder
    Commented Jun 8, 2016 at 8:21
  • Updated answer to reflect this :) Commented Jun 9, 2016 at 15:15

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.