surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.01k stars 782 forks source link

A Ranking Scale question with only one choice does not show any choices #6622

Closed thenakliman closed 11 months ago

thenakliman commented 11 months ago

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

Reporting a bug

What is the current behavior?

When ranking question has just one choice then ranking component title is shown but no choice

What is the expected behavior?

When ranking question has just one choice then component title with the available one choice should be available.

We have the requirement where choices are dynamic based on the user responses to previous questions. We have more than 8-9 choices overall but they appears conditional. There are 1-2 scenario where only once choice appear based on user previous question. It would have been okay if choice is already ranked if it s one but not showing any choice and showing title is confusing.

if you can suggest any workaround for now, it would help.

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

{
 "logoPosition": "right",
 "pages": [
  {
   "name": "page1",
   "elements": [
    {
     "type": "ranking",
     "name": "question1",
     "title": "What are you interested in?",
     "choices": [
      {
       "value": "Item 1",
       "text": "Math"
      }
     ]
    }
   ]
  }
 ]
}

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

Tested page URL: https://surveyjs.io/create-free-survey

Test code

Use above definition

Specify your

JaneSjs commented 11 months ago

+1 inquiry regarding the same issue was reported at https://github.com/surveyjs/survey-library/issues/6632.

ujwalkumar1995 commented 11 months ago

Hey people. I had raised the issue #6632. My problem is also similar. I was going through the code, have not contributed to this library before so I might be completely wrong but from the first looks feels like a simple enough fix of removing the explicit checks to handle 1 choice in question_ranking.ts

JaneSjs commented 11 months ago

Hello @ujwalkumar1995,

Thank you for your input; we truly appreciate it and value your suggestion. Our team is actively working on resolving this issue. Please stay tuned for any updates.

Thank you!