Web View steps allow you to present customized steps within a MyDataHelps survey. Although you can use most SDK methods from Web View steps, these methods are specifically used to control the logic of your custom step.
MyDataHelps.completeStep(optionalAnswerText)
Complete the current survey step. If called with a parameter, that parameter is saved as the answer for the step. If no parameter is supplied, then an empty string is saved as the answer. You can also store structured data such as JSON, as long as it’s formatted as a string. See Saving Survey Results for details.
The single answer to record for this step. If omitted, an empty string is recorded as the answer for the step.
<script type="text/javascript">
function next() {
var element = document.getElementById("StepInput");
var answerText = element.value;
MyDataHelps.completeStep(answerText);
}
function skip() {
MyDataHelps.completeStep();
}
</script>
<input type="text" id="StepInput" placeholder="Answer text" />
<button onclick="next()">Next</button>
<button onclick="skip()">Skip</button>
<script type="text/javascript">
function next() {
var element = document.getElementById("StepInput");
var answerText = element.value;
MyDataHelps.completeStep(answerText);
}
function skip() {
MyDataHelps.completeStep();
}
</script>
<input type="text" id="StepInput" placeholder="Answer text" />
<button onclick="next()">Next</button>
<button onclick="skip()">Skip</button>
MyDataHelps.getCurrentSurveyAnswers()
Used within a Web View step to retrieve the participant’s responses to other Question, Form, Consent, or Web View steps within the current survey.
Resolves to a result object containing the current survey answers.
Date/time of when the question was answered.
The step identifier from the survey designer.
This will usually be the same as the step identifier, but for form steps it will be the identifier of the specific form question.
MyDataHelps.getCurrentSurveyAnswers()
.then( function(result) {
console.log(result);
} );
MyDataHelps.getCurrentSurveyAnswers()
.then( function(result) {
console.log(result);
} );