Hi everyone, I am not specialized in JavaScript so I am having trouble with this fill-in-the-blank type. I have generated the code using Bard as below. But the thing is although it was successfully appear on the survey, the data is not collected. Can anyone help me for this? :(
The code I generated from Bard:
Qualtrics.SurveyEngine.addOnload(function() {
// Create the paragraph with fill-in-the-blank boxes
var paragraph = document.createElement("p");
paragraph.innerHTML = "I, <input type='text' name='ParentName' placeholder='Parent/Guardian Name'> give permission for my child, <input type='text' name='ChildName' placeholder='Child Name'> to participate in the research project, entitled, \"Youth Unemployment\". The study has been explained to me and my questions answered to my satisfaction. I understand that my child's right to withdraw from participating or refuse to participate will be respected and that his/her responses and identity will be kept confidential. I give this consent voluntarily.";
// Append the paragraph to the question container
var questionContainer = document.querySelector(".QuestionBody");
questionContainer.appendChild(paragraph);
// Collect the data when the page is unloaded and save it as embedded data
Qualtrics.SurveyEngine.addOnUnload(function() {
// Retrieve the entered values
var parentName = document.querySelector('inputename="ParentName"]').value;
var childName = document.querySelector('inputyname="ChildName"]').value;
// Save the values as embedded data
Qualtrics.SurveyEngine.setEmbeddedData("ParentName", parentName);
Qualtrics.SurveyEngine.setEmbeddedData("ChildName", childName);
});
});
The RESULT:
But I don’t know where the data of the fill-in-the-blank box appears TvT