-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsurveyjs.html
112 lines (95 loc) · 4.24 KB
/
surveyjs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html lang="en">
<head>
<title>Forms with SurveyJS</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<!-- Required Stylesheets -->
<link type="text/css" rel="stylesheet" href="https://unpkg.com/[email protected]/dist/css/bootstrap.min.css" />
<link type="text/css" rel="stylesheet" href="https://unpkg.com/[email protected]/dist/bootstrap-vue.css" />
<!-- Load polyfills to support older browsers -->
<!-- Blocked by Edge so getting rid of it
<script src="https://polyfill.io/v3/polyfill.min.js?features=es2015%2CIntersectionObserver"></script>
-->
<!-- Required scripts -->
<script src="https://unpkg.com/[email protected]/dist/vue.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/bootstrap-vue.js"></script>
<!-- Load the following for BootstrapVueIcons support -->
<script src="https://unpkg.com/[email protected]/dist/bootstrap-vue-icons.min.js"></script>
<!-- Extra libraries needed by BootstrapVue -->
<script src="https://unpkg.com/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/portal-vue.umd.min.js"></script>
<!-- ... -->
<link href="https://unpkg.com/survey-core/defaultV2.min.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="https://unpkg.com/survey-core/survey.core.min.js"></script>
<!-- <script type="text/javascript" src="https://unpkg.com/survey-js-ui/survey-js-ui.min.js"></script> -->
<script type="text/javascript" src="https://unpkg.com/survey-vue-ui/survey-vue-ui.min.js"></script>
<!-- ... -->
</head>
<body>
<div id="app">
<template>
<Survey :survey="survey" />
</template>
</div>
<script>
const surveyJson = new SurveyVue.Model(
{
"logoPosition": "right",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "boolean",
"name": "question3",
"title": "Your answer:",
"isRequired": true
},
{
"type": "paneldynamic",
"name": "question2",
"visibleIf": "{question3} = true",
"templateElements": [
{
"type": "multipletext",
"name": "question1",
"title": "QSG",
"isRequired": true,
"items": [
{
"name": "text1",
"title": "some question"
},
{
"name": "text2",
"title": "another question"
}
]
}
],
"panelCount": 1,
"minPanelCount": 1
}
]
}
]
}
);
surveyJson.onComplete.add(function (sender, options) {
// Display the "Saving..." message (pass a string value to display a custom message)
console.log(JSON.stringify(sender.data))
options.showSaveInProgress();
options.showSaveSuccess();
});
// 1. Create a vue root instance
window.app = new Vue({
el: '#app',
data: {
survey: surveyJson
}
})
</script>
</body>
</html>