Question X in a question block has a list of answers (not the values for a respondent, the actual text in the answers).
Question X+1 in the block has some javascript that uses those answers to do some stuff.
The question block is intended to be copied and re-used across surveys (so I don't want to hard code the question ID anywhere)
It looks like there are two ways to do this:
1) Set/Get embedded data.
I can pass the QID from question X into the value, and then retrieve it in question X+1, however, I'm messing up the syntax to reference the answer text in the prior question...
var myQID = Qualtrics.SurveyEngine.getEmbeddedData("myQuestionID")
var myAnswerArray = jquery("#"+myQID).getAnswers()
2) Initialize field names in the header, and write functions to update/retrieve them from the global variables defined in the header. I'm slightly concerned that this makes re-using the question block less monkey simple, but maybe it's the better approach?
Any thoughts on which is the better approach, and my broken syntax above?
['newbie' is a kind word for me, btw]
Best answer by TomG
View original