Survey.StylesManager.applyTheme("bootstrap");
Survey.defaultBootstrapCss.navigationButton = "btn btn-green";
var json = {
questionTitlePattern: "requireNumTitle",
questionStartIndex: "# A)",
requiredText: "(*)",
pages: [
{
"title": "This is the page {pageno} of {pagecount}.",
"elements": [
{
"type": "text",
"name": "name",
"title": "Please type your name",
"isRequired": true
},
{
"type": "text",
"name": "email",
"title": "Please type your e-mail",
"isRequired": true,
"validators": [ { "type": "email" } ]
}
]
},
{
"title": "This is the page {pageno} of {pagecount}.",
"elements": [
{
"type": "comment",
"name": "comment",
"title": "{name}, please tell us what is on your mind"
}
]
}
],
completedHtml: "<p><h4>Thank you for sharing this information with us.</h4></p><p>Your name is: <b>{name}</b></p><p>Your email is: <b>{email}</b></p><p>This is what is on your mind:</p><p>{comment}</p>"
};
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.render("surveyElement");
<!DOCTYPE html>
<html lang="en">
<head>
<title>Process Text, 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 rel="stylesheet" href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="./index.css">
</head>
<body>
<div id="surveyElement" style="display:inline-block;width:100%;">
</div>
<div id="surveyResult"></div>
<script type="text/javascript" src="./index.js"></script>
</body>
</html>