When running this code, the expected output will display the name
and the choices
.
To clarify, I aim to substitute the values of Not effective
, Neither effective nor Effective
, Effective
with "A", "B", and "C", respectively.
I am facing difficulty in identifying any issues or omissions within my code. It appears to function correctly only when selecting Not effective
for Question 1, Neither effective nor Effective
for Question 2, and Effective
for Question 3.
Here is the output generated when choosing Not effective
for all questions: output
Survey
.StylesManager
.applyTheme("defaultV2");
const json = {
pages: [
{
questions: [
{
type: "radiogroup",
name: "Question 1",
title: "Deliver through others.",
choices: [
"Not effective",
"Neither effective nor Effective",
"Effective"
]
},
{
type: "radiogroup",
name: "Question 2",
title: "Understand others perspective.",
choices: [
"Not effective",
"Neither effective nor Effective",
"Effective"
]
},
{
type: "radiogroup",
name: "Question 3",
title: "Solve complex problems.",
choices: [
"Not effective",
"Neither effective nor Effective",
"Effective"
]
},
]
}
]
};
window.survey = new Survey.Model(json);
survey
.onComplete
.add(function (sender) {
let data = JSON.stringify(sender.data)
data = data.replace("Not effective", "A")
data = data.replace("Neither effective nor Effective", "B")
data = data.replace("Effective", "C")
var obj = JSON.parse(data)
document
.querySelector('#surveyResult')
.textContent = "Result JSON:\n" + JSON.stringify(obj, null, 3);
});
var app = new Vue({
el: '#surveyElement',
data: {
survey: survey
}
});