From 5e581dd4877b8a07cf4e5d93d96d5c460a101498 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Thu, 26 Jun 2008 13:13:06 +0000 Subject: [PATCH] MDL-15139 - Cannot create Random Short Answer questions becuase the validation code is buggy. Fix thanks to Paul-Andre Chasse. --- .../type/randomsamatch/edit_randomsamatch_form.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/question/type/randomsamatch/edit_randomsamatch_form.php b/question/type/randomsamatch/edit_randomsamatch_form.php index 21919fc3f2..72a772831c 100644 --- a/question/type/randomsamatch/edit_randomsamatch_form.php +++ b/question/type/randomsamatch/edit_randomsamatch_form.php @@ -50,12 +50,11 @@ class question_edit_randomsamatch_form extends question_edit_form { function validation($data, $files) { global $QTYPES, $DB; $errors = parent::validation($data, $files); - if (isset($data['usecurrentcat'])){ - $category = $data['category']; - }else{ - $category = $data['categorymoveto']; + if (isset($data->categorymoveto)) { + list($category) = explode(',', $data['categorymoveto']); + } else { + list($category) = explode(',', $data['category']); } - $saquestions = $QTYPES['randomsamatch']->get_sa_candidates($category); $numberavailable = count($saquestions); if ($saquestions === false){ @@ -72,6 +71,5 @@ class question_edit_randomsamatch_form extends question_edit_form { return $errors; } - } ?> -- 2.39.5