Hi All,
I was wondering if there is a way to temporarily store a question response so that it can be accessed in later survey pages. But such that the response isn’t actually recorded in the data. Something similar to a local variable in other coding environments.
The specifics: We are designing a survey where we are asking students to provide characteristics about their best friends. To aid them with the task, we want to pipe in their friends’ names throughout the survey after they list them on an earlier page. However, due to agreements with our research partner, we can never actually store the names that they provide. They are completely fine with us using the names as an aid as long as they aren’t actually saved.
Any suggestions would be greatly appreciated!
Page 1 / 1
Questions are always recorded. Embedded variables are only recorded if they are defined in the survey flow. Otherwise, they are only available during the survey.
So, to accomplish your goal, you could create your own input fields in html, then use JavaScript to save the values of those fields to embedded data.
So, to accomplish your goal, you could create your own input fields in html, then use JavaScript to save the values of those fields to embedded data.
Thanks! That sounds just like what we are looking for -- I will attempt to implement something along those line.
Hi Tom,
I am finally getting around to implement this in our survey. I know how to create my own input fields in html, but I am uncertain on how to save the values of those fields to embedded data using JavaScript. Do you have any documentation or examples that could nudge me in the correct direction?
Thanks,
William
I am finally getting around to implement this in our survey. I know how to create my own input fields in html, but I am uncertain on how to save the values of those fields to embedded data using JavaScript. Do you have any documentation or examples that could nudge me in the correct direction?
Thanks,
William
Just wanted to provide an update. I believe I was able to get it working. Below is some code that works with one text input.
HTML:
!
JavaScript (put in addOnReady):
var input = document.getElementById("f1");
input.addEventListener("change", function() {
inputValue = document.getElementById("f1").value;
Qualtrics.SurveyEngine.setEmbeddedData( 'test1', inputValue) ;
});
HTML:
!
JavaScript (put in addOnReady):
var input = document.getElementById("f1");
input.addEventListener("change", function() {
inputValue = document.getElementById("f1").value;
Qualtrics.SurveyEngine.setEmbeddedData( 'test1', inputValue) ;
});
> @wmurdock said:
> Just wanted to provide an update. I believe I was able to get it working. Below is some code that works with one text input.
Nice! Now to have it work efficiently for unlimited inputs use a class and jQuery:
HTML:
```
<input type="text" class="norec" name="f1">
<input type="text" class="norec" name="f2">
...etc...
```
JS:
```
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
jQuery("#"+this.questionId+" .norec").each(function(i) {
Qualtrics.SurveyEngine.setEmbeddedData("test"+(i+1), this.value.trim());
});
});
```
> Just wanted to provide an update. I believe I was able to get it working. Below is some code that works with one text input.
Nice! Now to have it work efficiently for unlimited inputs use a class and jQuery:
HTML:
```
<input type="text" class="norec" name="f1">
<input type="text" class="norec" name="f2">
...etc...
```
JS:
```
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
jQuery("#"+this.questionId+" .norec").each(function(i) {
Qualtrics.SurveyEngine.setEmbeddedData("test"+(i+1), this.value.trim());
});
});
```
Thanks Tom! This is all amazing.
Just a quick question about documentation. Do you know of any official Qualtrics documentation that conveys the following statement from your first comment? "Embedded variables are only recorded if they are defined in the survey flow. Otherwise, they are only available during the survey." I know it is true, but our research partner has requested some type of official documentation before they will sign off on our design.
My searches are coming up empty handed.
Just a quick question about documentation. Do you know of any official Qualtrics documentation that conveys the following statement from your first comment? "Embedded variables are only recorded if they are defined in the survey flow. Otherwise, they are only available during the survey." I know it is true, but our research partner has requested some type of official documentation before they will sign off on our design.
My searches are coming up empty handed.
> @wmurdock said:
> Thanks Tom! This is all amazing.
>
> Just a quick question about documentation. Do you know of any official Qualtrics documentation that conveys the following statement from your first comment? "Embedded variables are only recorded if they are defined in the survey flow. Otherwise, they are only available during the survey." I know it is true, but our research partner has requested some type of official documentation before they will sign off on our design.
>
> My searches are coming up empty handed.
Sorry, I don't recall ever seeing it in any Qualtrics documentation. It is just something I know from experience. You can try contacting Qualtrics Support.
> Thanks Tom! This is all amazing.
>
> Just a quick question about documentation. Do you know of any official Qualtrics documentation that conveys the following statement from your first comment? "Embedded variables are only recorded if they are defined in the survey flow. Otherwise, they are only available during the survey." I know it is true, but our research partner has requested some type of official documentation before they will sign off on our design.
>
> My searches are coming up empty handed.
Sorry, I don't recall ever seeing it in any Qualtrics documentation. It is just something I know from experience. You can try contacting Qualtrics Support.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.