surveyjs / survey-creator

Scalable open-source survey software to generate dynamic JSON-driven forms within your JavaScript application. The form builder features a drag-and-drop UI, CSS Theme Editor, and GUI for conditional logic and form branching.
https://surveyjs.io/open-source
Other
910 stars 372 forks source link

Custom questions in survey JS create is not available to change the question name. #2796

Closed DeepikaSharma5 closed 2 years ago

DeepikaSharma5 commented 2 years ago

Is there a way to change the name (question1) in to a custom question name?

In your 'Toolbox categorize' we can add custom questions. But we are unable to add a default name to the question. Currently it is showing as question1, question2.

Rather than that it is better if we can customize the question name in the coding too.

https://surveyjs.io/Examples/Survey-Creator/?id=toolboxcategories&platform=Knockoutjs&theme=bootstrap#content-result

`creator

.toolbox
.addItem({
    name: "countries",
    isCopied: true,
    iconName: "icon-default",
    title: "All countries",
    category: "Custom",
    json: {
        "type": "dropdown",
        optionsCaption: "Select a country...",
        choicesByUrl: {
            url: "https://surveyjs.io/api/CountriesExample"
        }
    }
});`

survey

Better to change the 'question1' into 'Select a country'. Is there a way to do that?

DeepikaSharma5 commented 2 years ago

Also in your code you have added country options. What If I want to add custom dropdown data without URL? If I add like this,

` creator

.toolbox
.addItem({
name: "countries",
isCopied: true,
iconName: "icon-default",
title: "All countries",
category: "Custom",
json: {
    "type": "dropdown",
    optionsCaption: "Select a country...",
   choices: [
      { 
          "name" : "USA"
      },
      { 
          "name" : "Canada"
      },
  ],
}
});`

in the UI I am getting something like [object Object] as options. So how can I add values without URL?

andrewtelnov commented 2 years ago

Here is the working example.

Thank you, Andrew