diff --git a/question/type/ddimageortext/lang/en/qtype_ddimagetoimage.php b/question/type/ddimageortext/lang/en/qtype_ddimagetoimage.php
index 1f744a6e232..e065751d67b 100644
--- a/question/type/ddimageortext/lang/en/qtype_ddimagetoimage.php
+++ b/question/type/ddimageortext/lang/en/qtype_ddimagetoimage.php
@@ -48,6 +48,7 @@ $string['formerror_nobgimage'] = 'You need to select an image to use as the back
$string['infinite'] = 'Infinite';
$string['label'] = 'Label';
$string['nolabel'] = 'No label text';
+$string['pleasedraganimagetoeachdropregion'] = 'Your answer is not complete, please drag an image to each drop region.';
$string['previewarea'] = 'Preview area -';
$string['previewareaheader'] = 'Preview';
$string['previewareamessage'] = '
- Select a background image file.
- Select draggable images.
- And define drop zones by selecting an image that the student must drag to the drop zone and drag it to where the student should drag it too.
';
diff --git a/question/type/ddimageortext/question.php b/question/type/ddimageortext/question.php
index 9e76dcf5068..42439880685 100755
--- a/question/type/ddimageortext/question.php
+++ b/question/type/ddimageortext/question.php
@@ -99,6 +99,12 @@ class qtype_ddimagetoimage_question extends qtype_gapselect_question_base {
$filearea, $args, $forcedownload);
}
}
+ public function get_validation_error(array $response) {
+ if ($this->is_complete_response($response)) {
+ return '';
+ }
+ return get_string('pleasedraganimagetoeachdropregion', 'qtype_ddimagetoimage');
+ }
}
diff --git a/question/type/ddimageortext/renderer.php b/question/type/ddimageortext/renderer.php
index 4b28e5e8731..8805b2d9ea5 100755
--- a/question/type/ddimageortext/renderer.php
+++ b/question/type/ddimageortext/renderer.php
@@ -119,6 +119,11 @@ class qtype_ddimagetoimage_renderer extends qtype_with_combined_feedback_rendere
$sendtojs,
true,
$jsmodule);
+ if ($qa->get_state() == question_state::$invalid) {
+ $output .= html_writer::nonempty_tag('div',
+ $question->get_validation_error($qa->get_last_qt_data()),
+ array('class' => 'validationerror'));
+ }
return $output;
}