Hi Everyone,
I have a single answer choice question Q4 in survey and I want to store some xyz value in the Embedded data field depending upon the choice selected in Q4. After that, I am using the Embedded data as a pipe text in the next question Q5.
Q4 and Q5 both questions are in separate blocks. Firstly, I tried doing this through branch logic in survey flow but the problem I am facing is the Back button gets disabled from the page when we use branch logic between the elements or blocks.
Client wants the Back button to be enabled so we are thinking if this can be achieved through custom javascript. I tried below code through which I am able to retrieve the alert box on Q4 showing the value selected but it is not setting the value in the embedded data. Name of the embedded data is Q5 CES Text.
Any help will be appreciated!
Code Below:
var selectedRecode;
this.questionclick = function(event, element) {
if(element.type == "radio")
{selectedRecode = Number(this.getChoiceRecodeValue(this.getSelectedChoices()));
alert(selectedRecode);
if (selectedRecode == 1)
{
Qualtrics.SurveyEngine.setEmbeddedData('Q5 CES Text', test1);
alert(selectedRecode);
}
}}
Best answer by rondev
View original