Cart Licenses Contact Support Online Creator Log in/Register
v 1.9.43

Predefine Answers

You can set a question's defaultValue, which will be used until a proper value is specified by a user or programmatically. If the proper value is never specified, defaultValue is saved in the survey results.

const surveyJson = {
  "elements": [{
    "name": "subscribed",
    "type": "checkbox",
    "title": "I agree to receive weekly newsletters"
    "defaultValue": true

You can set the question value property or call the Survey's setValue(questionName, newValue) method to change the value at any point in your application:

import { Model } from "survey-core";

const survey = new Model(surveyJson);
survey.setValue("subscribed", false);

Tell Us What You Think

Help us serve you better by taking this brief survey.
We are interested to learn more about your
experience of using our libraries.

We'd really appreciate your feedback.

Start the Survey

Approximate time to complete: 2 min.