# Radio Buttons (Multiple Possible)

**URL:** <https://discourse.processing.org/t/radio-buttons-multiple-possible/25068>\
**Category:** Coding Questions\
**Created:** [October 31, 2020, 1:32am UTC](https://discourse.processing.org/t/radio-buttons-multiple-possible/25068 "2020-10-31T01:32:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BigBigRed](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@BigBigRed](https://discourse.processing.org/u/BigBigRed)\
**Post date:** [October 31, 2020, 1:32am UTC](https://discourse.processing.org/t/radio-buttons-multiple-possible/25068/1 "2020-10-31T01:32:24Z")

</div>

On my sketch, I would like to have multiple groups of radio buttons.  
So group 1 would be ‘Feature 1 - turn On, turn Off’,  
group 2 would be ‘Feature 2 - turn On, turn Off’,  
group 3 would be ’ Feature 3 - either 0, 1, 2, or 3’,  
right now, with eight possibilities ( 2 + 2 +4) only 1 of the eight buttons can be chosen.  
so can’t make the Group 1 choice, the Group 2 choice and then the Group 3 choice.

Does anyone have any suggestions/help?  
Thanks

---

<div class="post-metadata">

**Author:** ![ErraticGenerator](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/erraticgenerator/32/11304_2.png) [@ErraticGenerator](https://discourse.processing.org/u/ErraticGenerator)\
**Post date:** [December 11, 2020, 12:34am UTC](https://discourse.processing.org/t/radio-buttons-multiple-possible/25068/2 "2020-12-11T00:34:26Z")

</div>

If you look at the browser inspector DOM tree, you will notice that all the radio inputs created with p5js have the same `name` attribute value `radioOption`. Each radio group needs to have a different name so they can be selected independently. You can override this with `.attribute()`

```auto
let radio1;
let radio2;

function setup() {
  noCanvas()
  radio1 = createRadio();
  radio1.option('black');
  radio1.option('white');
  radio1.attribute('name', 'first')
  
  radio2 = createRadio()
  radio2.option('1')
  radio2.option('2')
  radio2.attribute('name', 'second')
}

```
