From b09519e892d1760be3628496f9bd3fe4852c37ff Mon Sep 17 00:00:00 2001 From: supriyarajgopal-spi Date: Thu, 28 Jul 2016 19:01:33 +0530 Subject: [PATCH] Added additional condition to read 'showSolutionButton' property if and only if 'params.override' is not undefined. This solves the Javascript error while using QuestionSet inside CoursePresentation. --- js/questionset.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/questionset.js b/js/questionset.js index 912b8b3..c60e422 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -130,7 +130,11 @@ H5P.QuestionSet = function (options, contentId) { var $template = $(template.render(params)); // Set overrides for questions var override; - if (params.override.showSolutionButton || params.override.retryButton) { + //Modified by SUPRIYA RAJGOPAL on 28Jul16 to prevent 'Cannot read property showSolutionButton of undefined' error when used in Course Presentation + /*----------------------------------------------------------------------*/ + //if (params.override.showSolutionButton || params.override.retryButton) { + if (params.override !== undefined && (params.override.showSolutionButton || params.override.retryButton)) { + /*----------------------------------------------------------------------*/ override = {}; if (params.override.showSolutionButton) { // Force "Show solution" button to be on or off for all interactions