Question T9321
Visible to All Users

Dropdown/Checkbox/radio customization

created 3 years ago

Hi Team,

Need help on achieving the following Scenario.

I have two array list as shown below :

Reviewers : [name1,name2, name3]
Approvers: [name4,name5,name6]

In the designer tab, for dropdown/radio/checkbox type questions I should be able to see the options as Reviewers,Approvers(variable array names) and also should be able to select one of it and create the survey.

For the respective questions,
If Reviewers are selected in the designer tab, then I should be able to see name1,name2,name3 as the options in Preview tab.
If Approvers are selected in the designer tab, then I should be able to see name4,name5,name6 as the options in Preview tab.

Requesting your help on this.

Thanks and Regards,
Santosh

Answers approved by surveyjs Support

created 3 years ago

Hello Santosh,
Sure, here is the code and example:

JavaScript
var userType = "reviewer"; const reviewerNames = ["Name 1""Name 2""Name 3"]; const approversNames = ["Name 11""Name 12""Name 13"]; Survey.Serializer.addProperty("survey", {name"users"choices() => {     return userType === "reviewer" ? reviewerNames : approversNames; }, category"general"visibleIndex3});

In fact choices function support Ajax call. Here is the documentation.

Thank you,
Andrew
SurveyJS Team

    Comments (2)

      Hi Andrew,

      Thanks for the response. But I am not able to use Survey.Serializer, even though i have imported import { Survey } from 'survey-angular'; its throwing error that Property serializer doesn't exist.

      Request your help on this.

      Thanks and Regards,
      Santosh

        You don't need to import "survey-angular" for Creator. We do not have Angular rendering yet, we are working on it, and we are using knockout rendering.
        Here is the Angular app for Creator V2 with the same code.

        Thank you,
        Andrew
        SurveyJS Team