- User-Defined Question Example
- User-Defined Question Example
- "12a754af-5841-4780-b592-b116311987c2
- Use this very simple question example to create a User-Defined question to observe its behavior in the Developer. The code can be modified to meet your question needs.
- This sample code includes diagnostic feedback that appears at the top of the question. There are 4 parameters (kpnextpage, kpmode, kpfeedbk, kprnda) that are populated from the Knowledge Center and one parameter (kpremed) populated from the Developer.
- : This parameter is the full URL to the portal page where tracking data is sent.
- kpnextpage
- : This parameter indicates if a question is being played within a course, pre-assessment, or post-assessment.
- kpmode
- : This parameter indicates if feedback is enabled within the assessment. The parameter is on, by default, for courses.
- kpfeedbk
- : This parameter indicates if answers are randomized in order. This parameter is off, by default, for courses.
- kprnda
- : This parameter indicates the remediation mode currently set within the course or assessment.
- kpremed
- To remove these parameters from your question, delete the bolded code from the example code.
- Note:
- Sample User-Defined Question Code
- <html>
- var isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
- function GetQueryStringValue(param) {
- var strQueryString;
- var QueryItems = strQueryString.split("&");
- var kpmode = GetQueryStringValue("kpmode");
- function SendResult(score, answer){
- // code to send score and answer back to Knowledge Pathways
- if (kpResultURL == "") {
- if (isNaN(score)) {
- return true;
- function ProcessResult() {
- // determine if the answer is correct, if correct score = 1
- for (var i=0; i<objForm.elements.length;i++) {
- </script>
- <body>
- document.write("kpremed indicates the remediation mode currently set within the course or assessment.</b>");
- document.write("kpfeedbk indicates if feedback is enabled within the assessment. Always enabled in courses.</b>");
- switch(kpfeedbk){
- document.write("kprnda indicates if answers should be randomized in order. Always disabled in courses.</b>");
- document.write("kpnextpage indicates the full URL to the Portal page to which tracking data must be sent.</b>");
- <form method="GET" action="" name="QuestionForm" target="">
- </form>
- Copy the User-Defined example HTML from the Developer help system and paste into Notepad or other program and save with an .htm extension.
- Warning!
- On the
- File
- New
- Package
- the
- Add
- .htm
- the new package.
- Save
- On the
- File
- New
- Question
- User-Defined
- Click
- Update Link
- Select the
- .htm
- Click
- OK
- Select the percentage of correct answers (0-100%) needed to pass the question in the
- Correct Score
- Save the question.
- To create a User-Defined question:
- On the
- File
- New
- Question
- User-Defined
- Click
- Update Link
- Select the file containing the code.
- Click
- OK
- Select the default value in the
- Correct Score
- Save the question.