Question T13369
Visible to All Users

Default values for the choices coming from url

created 2 years ago

Can we set default values for the choices coming from url?

Answers approved by surveyjs Support

created 2 years ago

Hello,
You can enable the Lazy Loading feature, define the defaultValue property and load it using the onGetChoiceDisplayValue event handler. For more information, please refer to the following demo: Lazy Loading.

    Show previous comments (7)

      Hello Vani,
      The suggestion that Jane provided should work.
      You can get the default value on survey.onLoadChoicesFromServer event and set it to your question "defaultValue" property.

      Thank you,
      Andrew
      SurveyJS Team

        So the defaultValue property works fine for APIs that don't require authorization. However, when we're using our internal APIs, we get the following error:

        Screenshot.png

        So how can we authorize our internal APIs? They work fine for displaying the dropdown list when a user is filling out the form, but only for setting a defaultValue are they throwing this error. Thank you!

          Hello Vani,
          The error comes from your server side, your server code. Our libraries only display this error.

          Thank you,
          Andrew
          SurveyJS Team