Add a tool that allows a user to search for and select a course (not including a section) and pull its attributes into your survey as Embedded Data.
Step 1
Create a Text Entry Question with instructions similar to the following:
Search for and select the course for which you would like to request a change to a lab or a course fee. For example, if the course is MGMT-4860, start typing 'MGMT-4860' and then tap/click on the course when you see it in the list below.
Step 2
Click the ‘</> JavaScript’ button in the question options to add JavaScript to the question, and replace the existing JavaScript code with the following code:
Qualtrics.SurveyEngine.addOnload(function() { /*Place your JavaScript here to run when the page loads*/ QObj = this; QObj.disableNextButton(); jQuery(QObj.questionContainer).find('.InputText').attr('placeholder', "Search by Course...") jQuery(QObj.questionContainer).find('.InputText').autocomplete({ source: function( request, response){ jQuery.ajax({ url: 'https://qualtrics.uvu.edu/public/coursesearch', dataType: 'json', data: { key: "allthedata", term: request.term }, success: function( data ) { response(data.map(function (value) { return { 'label': value.id + ' - ' + value.title, 'value': value.id, 'subject': value.subject, 'number': value.number }; })); } }) }, minLength: 3, select: function(event, ui) { event.preventDefault(); jQuery(this).val(ui.item.label) Qualtrics.SurveyEngine.setEmbeddedData("courseSubject", ui.item.subject); Qualtrics.SurveyEngine.setEmbeddedData("courseNumber", ui.item.number); jQuery(".ui-menu").hide(); QObj.enableNextButton(); return false; }, focus: function(event, ui) { return false; } }); }); Qualtrics.SurveyEngine.addOnReady(function() { /*Place your JavaScript here to run when the page is fully displayed*/ }); Qualtrics.SurveyEngine.addOnUnload(function() { /*Place your JavaScript here to run when the page is unloaded*/ jQuery(QObj.questionContainer).find('.InputText').autocomplete("destroy"); });
Step 3
Add a Web Service call to the survey flow below the question block that has the question you created in Step 1. Use the image below as a reference. The required fields are listed after the image, so you can copy and paste as needed.
URL: https://qualtrics.uvu.edu/public/courseData.php
Method: GET
Query Parameters
courseSubject = ${e://Field/courseSubject}
courseNumber = ${e://Field/courseNumber}
Custom Headers
X-UVU-SECURE = CourseData
Set Embedded Data
courseTitle = data.courseTitle
courseDescription = data.courseDescription
courseSubject = data.courseSubject
courseNumber = data.courseNumber
effectiveTerm = data.effectiveTerm
creditHrLow = data.creditHrLow
creditHrHigh = data.creditHrHigh
lecHrLow = data.lecHrLow
lecHrHigh = data.lecHrHigh
labHrLow = data.labHrLow
labHrHigh = data.labHrHigh
courseDepartmentCode = data.courseDepartmentCode
courseDepartmentDesc = data.courseDepartmentDesc
courseCollegeCode = data.courseCollegeCode
courseCollegeDesc = data.courseCollegeDesc
attributeCode0 = data.courseAttributes.0.attributeCode
attributeDesc0 = data.courseAttributes.0.attributeDesc
attributeCode1 = data.courseAttributes.1.attributeCode
attributeDesc1 = data.courseAttributes.1.attributeDesc
attributeCode2 = data.courseAttributes.2.attributeCode
attributeDesc2 = data.courseAttributes.2.attributeDesc
attributeCode3 = data.courseAttributes.3.attributeCode
attributeDesc3 = data.courseAttributes.3.attributeDesc
attributeCode4 = data.courseAttributes.4.attributeCode
attributeDesc4 = data.courseAttributes.4.attributeDesc
attributeCode5 = data.courseAttributes.5.attributeCode
attributeDesc5 = data.courseAttributes.5.attributeDesc
Note: The text on the left side of the = sign under the Set Embedded Data section are the Embedded Data field names, which can be used throughout the survey to see the values returned by the API.