I'm trying to write custom code to overwrite the responses from previous questions. Near the end of our survey, I use piped text to display responses from earlier in the survey. I only want to overwrite these responses after displaying them at the end of the survey, but before they are recorded. I want to do this using javascript/jquery at the end of the survey to avoid the complexity of setting embedded data fields for each individual question.
Ideally, the process would be something like this: use the QID of questions from previous blocks to access the responses. Then, change the values that respondents gave, but only at the very end of the study; this is why the responses cannot be overwritten or deleted on the page immediately after the respondent leaves the page.
I know we can used piped text to display text from previous questions/responses; how can I modify those previous responses?
Here's what I've tried before:
1) Setting a variable to
`${q://QID3/ChoiceGroup/SelectedChoices`
and then setting that variable to a different string, but I think it doesn't work because it's only a reference.
2) Overwriting QID22's responses with "hello" using jQuery like so
`jQuery("#"+"QID22"+".ChoiceTextEntryValue").val("hello");`
but this only returned an empty string when we accessed
`"${q://QID22/ChoiceTextEntryValue}"`
Any advice on how to accomplish this would be greatly appreciated. Thanks.
Best answer by TomG
View original