Survey-library: Radio buttons & checkboxes do not have unique ID attributes

Created on 5 Nov 2018  路  7Comments  路  Source: surveyjs/survey-library

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
bug fixed

All 7 comments

this is definitely the bug because of https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id

The id global attribute defines a unique identifier (ID) which must be unique in the whole document.

@ekim-novus thank you for the reporting. Fix will be available in the next minor update.

Thanks @dmitrykurmanov !

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.

@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.

@zech unfortunately I've reverted that changes for survey-knockout because of technically problems with knockout and survey-creator. We will think about better decision.

PS for react and vue it will work as expexted and I didn't revert the changes.

Thanks. The changes in react will be sufficient for now i think.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

misamura picture misamura  路  4Comments

nadialo picture nadialo  路  4Comments

xiuzhen1103 picture xiuzhen1103  路  4Comments

ian-emsens-sb picture ian-emsens-sb  路  3Comments

enricribas picture enricribas  路  3Comments