<p>I'm not sure how to do a 3 way toggle with radio boxes, it might involve writing your own JS... but for the checkbox toggle it's pretty straight forward :)</p>

<pre><code>{{ forms.checkboxField({
    ...
    toggle : 'toggleThis'
}) }}

&lt;div id="toggleThis" {% if settings.eventClickDestination is not defined or not settings.eventClickDestination %} class="hidden"{% endif %}&gt;
  //.. Form input goes in here
&lt;/div&gt;
</code></pre>

<p>Craft will then take care of the toggling for you when the box is checked/unchecked</p>

CC BY-SA 3.0
2015-05-29T16:20:21.117Z
Thank you, Alec. Where does the `<div id="toggleThis"` go?
kr37
CC BY-SA 3.0
2015-05-29T16:23:16.320Z
Wherever in your template you want the field to appear :)
Alec Ritson
CC BY-SA 3.0
2015-05-29T14:44:56.447Z
2015-05-29T14:44:56.447Z
Alec Ritson
<p><a href="https://craftcms.stackexchange.com/questions/5067/how-to-use-plugin-settings">This answer</a> has given me most of what I need, but I'd like to hide certain settings based on the status of other settings. CP seems to have nice functionality built in for conditionally hiding/showing parameters. For example, when changing a field from Rich Text to Plain Text, several options disappear.</p>

<p>In this case, only if the preceding checkbox is checked do I want it to give an input field for the category field handle.</p>

<p>Here is my /craft/plugins/calendar37/templates/_settings.html file:</p>

<pre><code>{% import "_includes/forms" as forms %}

{{ forms.checkBox({
        label: "Event Hyperlinking"|t,
        id: 'eventClickDestination',
        name: 'eventClickDestination',
        instructions: "If checked, clicking on an event goes to Category page. Otherwise, unchecked it will go an Entry page"|t,
        value: settings.eventClickDestination,
        errors: settings.getErrors('eventClickDestination')
    })
}}

{{ forms.textField({
        label: "Category Field's Handle"|t,
        id: 'categoryFieldHandle',
        name: 'categoryFieldHandle',
        instructions: ""|t,
        value: settings.categoryFieldHandle,
        errors: settings.getErrors('categoryFieldHandle')
    }) 
}}
</code></pre>

<p>Note, I'd like to work out similar functionality with a 3-part radio button, but haven't figured out how to do radio buttons yet.</p>

<p>Thank you!</p>

<plugin-development><settings>
How to conditionally hide particular plugin settings?
# How to conditionally hide particular plugin settings?

(Asked by: username_0 on 2015-05-29)

This answer has given me most of what I need, but I'd like to hide certain settings based on the status of other settings. CP seems to have nice functionality built in for conditionally hiding/showing parameters. For example, when changing a field from Rich Text to Plain Text, several options disappear.
In this case, only if the preceding checkbox is checked do I want it to give an input field for the category field handle.
Here is my /craft/plugins/calendar37/templates/_settings.html file:
{% import "_includes/forms" as forms %}

{{ forms.checkBox({
        label: "Event Hyperlinking"|t,
        id: 'eventClickDestination',
        name: 'eventClickDestination',
        instructions: "If checked, clicking on an event goes to Category page. Otherwise, unchecked it will go an Entry page"|t,
        value: settings.eventClickDestination,
        errors: settings.getErrors('eventClickDestination')
    })
}}

{{ forms.textField({
        label: "Category Field's Handle"|t,
        id: 'categoryFieldHandle',
        name: 'categoryFieldHandle',
        instructions: ""|t,
        value: settings.categoryFieldHandle,
        errors: settings.getErrors('categoryFieldHandle')
    }) 
}}

Note, I'd like to work out similar functionality with a 3-part radio button, but haven't figured out how to do radio buttons yet.
Thank you!

**Tags:** plugin-development, settings

---

## 1 answers

### Answer by username_1 on 2015-05-29. Score: 2 | Accepted answer

I'm not sure how to do a 3 way toggle with radio boxes, it might involve writing your own JS... but for the checkbox toggle it's pretty straight forward :)
{{ forms.checkboxField({
    ...
    toggle : 'toggleThis'
}) }}


  //.. Form input goes in here


Craft will then take care of the toggling for you when the box is checked/unchecked

> **Comments:**
> **username_0**: Thank you, Alec. Where does the `<div id="toggleThis"` go?  
> **username_1**: Wherever in your template you want the field to appear :)  

---

