Survey.StylesManager.applyTheme("modern");
var json = {
"pages": [
{
"name": "page1",
"elements": [
{ "type": "rating", "name": "satisfaction", "title": "How satisfied are you with the Product?", "mininumRateDescription": "Not Satisfied", "maximumRateDescription": "Completely satisfied" },
{
"type": "panel",
"name": "panel1",
"title": "Please, help us improve our product",
"visibleIf": "{satisfaction} < 3",
"elements": [
{
"type": "checkbox",
"choices": [
{
"value": "1",
"text": "Customer relationship"
},
{
"value": "2",
"text": "Service quality"
},
{
"value": "3",
"text": "Support response time"
}
],
"name": "What should be improved?"
},
{
"type": "comment",
"name": "suggestions",
"title": "What would make you more satisfied with the Product?"
},
{
"type": "panel", "innerIndent": 1, "name": "panel2", "title": "Send us your contact information (optionally)", "state": "collapsed",
"elements": [
{ "type": "text","name": "name", "title": "Name:" },
{ "type": "text", "inputType": "email","name": "email", "title": "E-mail" }
]
}
]
}
]
}
]
};
window.survey = new Survey.Model(json);
survey.onComplete.add(function(sender) {
document.querySelector('#surveyResult').textContent =
"Result JSON:\n" + JSON.stringify(sender.data, null, 3);
});
survey.data = {satisfaction: 2};
survey.render("surveyElement");
<!DOCTYPE html>
<html lang="en">
<head>
<title>Panel, Knockoutjs Survey Library Example</title>
<meta name="viewport" content="width=device-width" />
<script src="https://unpkg.com/knockout@3.5.1/build/output/knockout-latest.js"></script>
<script src="/DevBuilds/survey-core/survey.core.min.js"></script>
<script src="/DevBuilds/survey-core/survey.i18n.min.js"></script>
<script src="/DevBuilds/survey-knockout-ui/survey-knockout-ui.min.js"></script>
<link href="/DevBuilds/survey-core/modern.min.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" href="./index.css">
</head>
<body style="margin: 0">
<div id="surveyElement" style="display:inline-block;width:100%;">
</div>
<div id="surveyResult"></div>
<script type="text/javascript" src="./index.js"></script>
</body>
</html>
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 SurveyApproximate time to complete: 2 min.