How do I add JavaScript to a question via an API POST statement?
I can add HTML fine, but I don't know how to set (or get) the JavaScript other than doing it manually for each question. I searched here, StackOverflow, and Google; I found plenty about working with JavaScript manually, but I couldn't locate anything about doing this via the API.
If it helps, below is a sample of my questionDef in Python. Each question ties to an ID, and the JavaScript creates the actual question text based on that ID (e.g., this one is question #486).
questionDef = {
"Configuration": {
"QuestionDescriptionOption": "UseText"
},
"DataExportTag": "Ques486Stem",
"DefaultChoices": False,
"QuestionDescription":"lbl_q486z-stem",
"QuestionText": '
"QuestionType": "TE",
"Selector": "SL"
}
I'm new to the API environment, so I apologize if I'm missing something obvious.
Best answer by BDT
Got it! Just include QuestionJS as a key within the question definition. For example, I might modify the code below to include QuestionJS:
QuestionJSquestionDef = {
"DataExportTag": "Ques486Stem",
...
"QuestionJS": <
}
