Radio input on Contact Plugin
Created 7 years ago by wcd_calum

Trying to make sense of the example given here (, what's the correct way to add radio buttons for this and could it be added to the documentation?

ryanthompson  —  7 years ago

That is showing you that you can configure fields just as you would (or similar) in migrations:

So for example you could use the select field type with radio mode:

wcd_calum  —  7 years ago

Thanks that helped. This is how I have done it for my custom layout:

{%  set form = form('example').fields({
    'querytype': {
        'label': 'Query type',
        'required': true,
        'type': '',
        'config' : {
          'options' : {
            'opt1' : 'Option 1',
            'opt2' : 'Option 2'
        'default_value' : 'opt1',
        'mode'          : 'radio'
{{|raw }}
 <label for="opt1"><input id="opt1" class="form-check-input" name="querytype" value="opt1" type="radio"> Option 1</label>
 <label for="opt2"><input id="opt2" class="form-check-input" name="querytype" value="opt2" type="radio"> Option 2</label>
{{ form.actions|raw }}
{{ form.close|raw }}
ryanthompson  —  7 years ago

If you could @wcdcalum format that with markdown so others can better read / use it ^^

Glad it helped! FYI that's kinda the same principle in defining fields everywhere - very little difference depending on where you are. Only real difference I guess is defining a field for a migration vs for a UI component (and even still very much exactly the same but for example field migrations only have limited columns).