question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Radio buttons & checkboxes do not have unique ID attributes

See original GitHub issue

Are you requesting a feature, reporting a bug or asking a question?

Reporting a bug

What is the current behavior?

The radio buttons and checkboxes that belong to the same group all have the same ID attribute, when instead IDs should be unique.

What is the expected behavior?

The individual radio buttons/checkboxes should either have different IDs, or the ID should maybe be moved to the containing <fieldset> tag.

How would you reproduce the current behavior (if this is a bug)?

Visit any survey with a radiogroup or checkbox question.

Provide the test code and the tested page URL (if applicable)

Tested page URL: sample radio group in the documentation

Specify your

  • browser: Chrome
  • browser version: 69.0.3497.100
  • surveyjs platform (angular or react or jquery or knockout or vue): react
  • surveyjs version: 1.0.53

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dmitrykurmanovcommented, Nov 5, 2019

@zech the bug fixed via the https://github.com/surveyjs/survey-library/commit/f7986e09d033273614184c652f1d1bfb68cf1867. Fix will be available in the next minor release. Thank you for the reporting.

1reaction
zechcommented, Oct 31, 2019

Hi,

I think at least for RadioButtons this bug is introduced (again). We’re using it with React and a column count of 4 and it triggers warnings in console.

I suspect this code is the issue because the index is not respecting the column count (ci) in line 49:

https://github.com/surveyjs/survey-library/blob/595c8fc065d30b7070367046d9e70f8d84bffa20/src/react/reactquestionradiogroup.tsx#L48-L50

Tagging @dmitrykurmanov. I hope it’s okay to append it to an existing issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should the id tag be unique in checkbox forms? - Stack Overflow
According to freecodecamp in their checkbox exercise all checkbox elements should have the same name and id,. No. It says they should have...
Read more >
<input type="radio"> - HTML: HyperText Markup Language
Where multiple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow multiple values to be selected....
Read more >
Grouping Controls | Web Accessibility Initiative (WAI) - W3C
The legend for a group of controls can also highlight common attributes of all controls, for example, to advise that all fields in...
Read more >
Add a theme_form_element()/theme_fieldset() function that ...
Hi, I have been using this module and it is excellent! In an attempt to skin the checkboxes and radio buttons (including the...
Read more >
Accessible Forms - Checkboxes and Radio Buttons
Checkboxes and radio buttons can impact web form accessibility if they're not used correctly. Learn how to use them and avoid the pitfalls....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found