diff --git a/edit_aitext_form.php b/edit_aitext_form.php index 989776c..705f5d4 100755 --- a/edit_aitext_form.php +++ b/edit_aitext_form.php @@ -51,6 +51,7 @@ protected function definition_inner($mform) { $mform->setType('aiprompt', PARAM_RAW); $mform->setDefault('aiprompt', get_config('qtype_aitext', 'defaultprompt')); $mform->addHelpButton('aiprompt', 'aiprompt', 'qtype_aitext'); + $mform->addRule('aiprompt', get_string('aipromptmissing', 'qtype_aitext'), 'required'); $mform->addElement('textarea', 'markscheme', get_string('markscheme', 'qtype_aitext'), ['maxlen' => 50, 'rows' => 6, 'size' => 30]); diff --git a/lang/en/qtype_aitext.php b/lang/en/qtype_aitext.php index 377d96a..dd1466c 100755 --- a/lang/en/qtype_aitext.php +++ b/lang/en/qtype_aitext.php @@ -27,6 +27,7 @@ $string['aiprompt'] = 'AI Prompt'; $string['aiprompt_help'] = 'A prompt for the Ai Grader. This is the guideline that AI uses to give feedback on the student response.'; +$string['aipromptmissing'] = 'The ai prompt is missing. Please enter a prompt on the basis of which the feedback is generated.'; $string['answerfiles'] = 'Answer files'; $string['answertext'] = 'Answer text'; $string['attachmentsoptional'] = 'Attachments are optional';