Creating a child/dependent checkbox in options

Paul B

XenForo moderator
Staff member
I'm creating a simple add-on which has two checkboxes.
However, the second is only available if the first checkbox is selected.

I've been playing around with various things, but can't quite get my head around <sub_options></sub_options>.
I've looked at the master options.xml file but it's not that helpful.

Can anyone explain in simple terms how to achieve this?

Can it be done from within the .xml or does it require an additional options template?

This is what I have at the moment:
Code:
<optiongroups>
    <group group_id="cta_options" display_order="1" debug_only="0"/>
    <option option_id="cta_option1_active" edit_format="onoff" data_type="boolean" can_backup="1">
        <default_value>1</default_value>
        <edit_format_params></edit_format_params>
        <sub_options></sub_options>
        <relation group_id="cta_options" display_order="10"/>
    </option>
    <option option_id="cta_suboption1_active" edit_format="onoff" data_type="boolean" can_backup="1">
        <default_value>1</default_value>
        <edit_format_params></edit_format_params>
        <sub_options></sub_options>
        <relation group_id="cta_options" display_order="20"/>
    </option>
</optiongroups>

I'd like the second "suboption1" to be a child of the first "option1".
 
Thanks to Mike, he has confirmed that an additional template is required.

Look at the Email Transport Method option for how to specify a template and then examine the template to see how it is defined.
 
Back
Top Bottom