-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Radio buttons interact with each other #6763
Comments
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you! |
You can prevent this by using a
If you don't explicitly set the name then they both get the same name Questions for the community:
This is the HTML that is created by original code (without the name argument). IMO it can be improved.
Both "bicycle" and "tiger" do have |
Thank you, that works! |
@lindapaiste @Qianqianye @limzykenneth @davepagurek I read the above issue mentioned by @Hansterdam and I would like to add more documentation for createradio() .In this instance would mention the consequences of not adding the name parameter and to better understand the importance of including the 'name' parameter, refer to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio. |
let myRadio; function setup() { // Add a few color options. // Choose a default option. describe('A yellow square with three options listed, "love", "joy", and "trust". The square changes color when the user selects a new option.'); function draw() { let c = myRadio.value(); this may help you |
For me I think unique name is a bit too magical (but that may be just me). For |
Yes I thing we have to use a standard system for naming like [page]-rdbtn-1. The last number is to be incremented for multiple radiobutton in a single page |
Hey, I tried to solve the issue and make some changes to the code , the problem is that we are not assigning a unique name attribute to the radio buttons, which causes multiple createRadio buttons to act as a single group. At present, the name attribute value is assigned only if a value is passed while calling the function otherwise it takes the default value 'radioOption'. For this I have provided one solution that is instead of radioOption as a default value we can generate a unique nameusing Math.random() function. If any reviewer confirm that this is the right approach , I would be interested making this changes. |
Most appropriate sub-area of p5.js?
p5.js version
1.9.0
Web browser and version
Brave 1.61.116 Chromium: 120.0.6099.217
Operating system
Windows 11
Steps to reproduce this
Steps:
Snippet:
The text was updated successfully, but these errors were encountered: