Skip to content

Commit de5227b

Browse files
authored
594 Fix formChild is null (#595)
When a student completed a questionnaire then shown the "Thank you for completing this Questionnaire" page there was a JavaScript error: Uncaught TypeError: formChild is null This was because the JavaScript for the questions form was being inadvertently loaded for the Thank you page where this form is not present.
1 parent 5c0dbe8 commit de5227b

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

classes/output/renderer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public function complete_formstart($action, $hiddeninputs=[]) {
147147
foreach ($hiddeninputs as $name => $value) {
148148
$output .= \html_writer::empty_tag('input', ['type' => 'hidden', 'name' => $name, 'value' => $value]) . "\n";
149149
}
150+
$this->page->requires->js_init_call('M.mod_questionnaire.init_attempt_form', null, false, questionnaire_get_js_module());
150151
return $output;
151152
}
152153

questionnaire.class.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,6 @@ public function view() {
270270

271271
$PAGE->set_title(format_string($this->name));
272272
$PAGE->set_heading(format_string($this->course->fullname));
273-
274-
// Initialise the JavaScript.
275-
$PAGE->requires->js_init_call('M.mod_questionnaire.init_attempt_form', null, false, questionnaire_get_js_module());
276-
277273
$message = $this->user_access_messages($USER->id, true);
278274
if ($message !== false) {
279275
$this->page->add_to_page('notifications', $message);

0 commit comments

Comments
 (0)