diff --git a/question/type/calculated/edit_calculated_form.php b/question/type/calculated/edit_calculated_form.php
index 1daa58f41cd..19bc26a7a72 100644
--- a/question/type/calculated/edit_calculated_form.php
+++ b/question/type/calculated/edit_calculated_form.php
@@ -243,7 +243,7 @@ class qtype_calculated_edit_form extends qtype_numerical_edit_form {
}
if (empty($mandatorydatasets)) {
foreach ($answers as $key => $answer) {
- $errors['answer['.$key.']'] =
+ $errors['answeroptions['.$key.']'] =
get_string('atleastonewildcard', 'qtype_calculated');
}
}
@@ -254,7 +254,7 @@ class qtype_calculated_edit_form extends qtype_numerical_edit_form {
if (trim($answer)) {
if ($data['correctanswerformat'][$key] == 2 &&
$data['correctanswerlength'][$key] == '0') {
- $errors['correctanswerlength['.$key.']'] =
+ $errors['answerdisplay['.$key.']'] =
get_string('zerosignificantfiguresnotallowed', 'qtype_calculated');
}
}
diff --git a/question/type/calculatedmulti/edit_calculatedmulti_form.php b/question/type/calculatedmulti/edit_calculatedmulti_form.php
index 5929420ab84..b0060b145bb 100644
--- a/question/type/calculatedmulti/edit_calculatedmulti_form.php
+++ b/question/type/calculatedmulti/edit_calculatedmulti_form.php
@@ -82,9 +82,8 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
$mform->setType('answer', PARAM_NOTAGS);
- $addrepeated = array();
- $addrepeated[] = $mform->createElement('hidden', 'tolerance');
- $addrepeated[] = $mform->createElement('hidden', 'tolerancetype', 1);
+ $repeated[] = $mform->createElement('hidden', 'tolerance');
+ $repeated[] = $mform->createElement('hidden', 'tolerancetype', 1);
$repeatedoptions['tolerance']['type'] = PARAM_FLOAT;
$repeatedoptions['tolerance']['default'] = 0.01;
@@ -262,7 +261,7 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
}
if (count($mandatorydatasets) == 0) {
foreach ($answers as $key => $answer) {
- $errors['answer['.$key.']'] =
+ $errors['answeroptions['.$key.']'] =
get_string('atleastonewildcard', 'qtype_calculated');
}
}
@@ -275,7 +274,7 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
continue;
}
if (empty($trimmedanswer)) {
- $errors['fraction['.$key.']'] = get_string('errgradesetanswerblank', 'qtype_multichoice');
+ $errors['answeroptions['.$key.']'] = get_string('errgradesetanswerblank', 'qtype_multichoice');
}
if ($trimmedanswer != '' || $answercount == 0) {
// Verifying for errors in {=...} in answer text.
@@ -292,10 +291,10 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
$qanswerremaining = $qanswersplits[1];
if (!empty($regs1[1]) && $formulaerrors =
qtype_calculated_find_formula_errors($regs1[1])) {
- if (!isset($errors['answer['.$key.']'])) {
- $errors['answer['.$key.']'] = $formulaerrors.':'.$regs1[1];
+ if (!isset($errors['answeroptions['.$key.']'])) {
+ $errors['answeroptions['.$key.']'] = $formulaerrors.':'.$regs1[1];
} else {
- $errors['answer['.$key.']'] .= '
'.$formulaerrors.':'.$regs1[1];
+ $errors['answeroptions['.$key.']'] .= '
'.$formulaerrors.':'.$regs1[1];
}
}
}
@@ -322,23 +321,23 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
}
}
if ($answercount == 0) {
- $errors['answer[0]'] = get_string('notenoughanswers', 'qtype_multichoice', 2);
- $errors['answer[1]'] = get_string('notenoughanswers', 'qtype_multichoice', 2);
+ $errors['answeroptions[0]'] = get_string('notenoughanswers', 'qtype_multichoice', 2);
+ $errors['answeroptions[1]'] = get_string('notenoughanswers', 'qtype_multichoice', 2);
} else if ($answercount == 1) {
- $errors['answer[1]'] = get_string('notenoughanswers', 'qtype_multichoice', 2);
+ $errors['answeroptions[1]'] = get_string('notenoughanswers', 'qtype_multichoice', 2);
}
// Perform sanity checks on fractional grades.
if ($data['single']== 1 ) {
if ($maxfraction != 1) {
- $errors['fraction[0]'] = get_string('errfractionsnomax', 'qtype_multichoice',
+ $errors['answeroptions[0]'] = get_string('errfractionsnomax', 'qtype_multichoice',
$maxfraction * 100);
}
} else {
$totalfraction = round($totalfraction, 2);
if ($totalfraction != 1) {
$totalfraction = $totalfraction * 100;
- $errors['fraction[0]'] =
+ $errors['answeroptions[0]'] =
get_string('errfractionsaddwrong', 'qtype_multichoice', $totalfraction);
}
}
diff --git a/question/type/numerical/edit_numerical_form.php b/question/type/numerical/edit_numerical_form.php
index 182c808fa33..4ca7b506518 100644
--- a/question/type/numerical/edit_numerical_form.php
+++ b/question/type/numerical/edit_numerical_form.php
@@ -288,27 +288,27 @@ class qtype_numerical_edit_form extends question_edit_form {
if ($trimmedanswer != '') {
$answercount++;
if (!$this->is_valid_answer($trimmedanswer, $data)) {
- $errors['answer[' . $key . ']'] = $this->valid_answer_message($trimmedanswer);
+ $errors['answeroptions[' . $key . ']'] = $this->valid_answer_message($trimmedanswer);
}
if ($data['fraction'][$key] == 1) {
$maxgrade = true;
}
if ($answer !== '*' && !is_numeric($data['tolerance'][$key])) {
- $errors['tolerance['.$key.']'] =
+ $errors['answeroptions['.$key.']'] =
get_string('xmustbenumeric', 'qtype_numerical',
get_string('acceptederror', 'qtype_numerical'));
}
} else if ($data['fraction'][$key] != 0 ||
!html_is_blank($data['feedback'][$key]['text'])) {
- $errors['answer[' . $key . ']'] = $this->valid_answer_message($trimmedanswer);
+ $errors['answeroptions[' . $key . ']'] = $this->valid_answer_message($trimmedanswer);
$answercount++;
}
}
if ($answercount == 0) {
- $errors['answer[0]'] = get_string('notenoughanswers', 'qtype_numerical');
+ $errors['answeroptions[0]'] = get_string('notenoughanswers', 'qtype_numerical');
}
if ($maxgrade == false) {
- $errors['fraction[0]'] = get_string('fractionsnomax', 'question');
+ $errors['answeroptions[0]'] = get_string('fractionsnomax', 'question');
}
return $errors;
diff --git a/question/type/shortanswer/edit_shortanswer_form.php b/question/type/shortanswer/edit_shortanswer_form.php
index aea0890d8fc..c707749ca7f 100644
--- a/question/type/shortanswer/edit_shortanswer_form.php
+++ b/question/type/shortanswer/edit_shortanswer_form.php
@@ -80,15 +80,15 @@ class qtype_shortanswer_edit_form extends question_edit_form {
}
} else if ($data['fraction'][$key] != 0 ||
!html_is_blank($data['feedback'][$key]['text'])) {
- $errors["answer[$key]"] = get_string('answermustbegiven', 'qtype_shortanswer');
+ $errors["answeroptions[$key]"] = get_string('answermustbegiven', 'qtype_shortanswer');
$answercount++;
}
}
if ($answercount==0) {
- $errors['answer[0]'] = get_string('notenoughanswers', 'qtype_shortanswer', 1);
+ $errors['answeroptions[0]'] = get_string('notenoughanswers', 'qtype_shortanswer', 1);
}
if ($maxgrade == false) {
- $errors['fraction[0]'] = get_string('fractionsnomax', 'question');
+ $errors['answeroptions[0]'] = get_string('fractionsnomax', 'question');
}
return $errors;
}