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.

Changing choices of a checkbox/ radio question programmatically by surveyModel should chnage choices of all the question with selected name, not the first occurence only

See original GitHub issue
JSON = {
 "pages": [
  {
   "name": "page1",
   "elements": [
    {
     "type": "dropdown",
     "name": "sourceModel",
     "title": "Source Model",
     "isRequired": true,
     "choices": [
      "m1",
      "m2"
     ]
    },
    {
     "type": "dropdown",
     "name": "type",
     "title": "Type of chart",
     "isRequired": true,
     "choices": [
      {
       "value": "big_number_1",
       "text": "Big Number"
      },
      {
       "value": "pie",
       "text": "Pie Chart"
      }
     ]
    },
    {
     "type": "panel",
     "name": "bign1Panel",
     "elements": [
      {
       "type": "text",
       "name": "title",
       "title": "Title",
       "isRequired": true
      },
      {
       "type": "radiogroup",
       "name": "column",
       "title": "Field containing the number (make sure the source has only one row after aggregation)",
       "choices": [
        "item1",
        "item2",
        "item3"
       ]
      }
     ],
     "visibleIf": "{type} = \"big_number_1\"",
     "title": "Big Number Configuration"
    },
    {
     "type": "panel",
     "name": "piePanel",
     "elements": [
      {
       "type": "radiogroup",
       "name": "column",
       "title": "Column to rotate",
       "choices": [
        "item1",
        "item2",
        "item3"
       ]
      }
     ],
     "visibleIf": "{type} = \"pie\"",
     "title": "Pie Chart Configuration"
    }
   ],
   "navigationButtonsVisibility": "hide"
  }
 ]
}
// In JS:
// we have 2 different questions with same name but different titles in different panels, 
// on changing 2nd question we execute following line
surveyModel.getQuestionByName("column").choices = ["s1","s2","s3"];
// above line does change the choices of the first title with name column but 2nd title with name column does not get the new choices.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
andrewtelnovcommented, Aug 6, 2018

@omkardusane This functionality has been implemented.

Thank you, Andrew

0reactions
omkardusanecommented, Aug 7, 2018

Thanks Surveyjs Team

Read more comments on GitHub >

github_iconTop Results From Across the Web

Check box variable - Ability to select multiple ch... - ServiceNow
We would like to have check box instead of radio button so that users can be able to select multiple choices. Any help...
Read more >
Single Column Question – SurveyMonkey Apply
The Single Column Question type allows you to create a question with a ... text response for name, or a checkbox/radio button for...
Read more >
REDCap Frequently Asked Questions - Wiki@UCSF
If you want to send surveys to participants and pipe in values (ex: first and last name); create a data entry instrument prior...
Read more >
Checkbox | Semantic UI
A checkbox allows a user to select a value from a small set of options, often binary.
Read more >
Angular mat-selection-list, How to make single checkbox ...
You have to set SelectionModel for selectedOptions property of component reference on init. @ViewChild(MatSelectionList, {static: true}) private ...
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