From: tjhunt Date: Thu, 26 Jun 2008 13:13:06 +0000 (+0000) Subject: MDL-15139 - Cannot create Random Short Answer questions becuase the validation code... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5e581dd4877b8a07cf4e5d93d96d5c460a101498;p=moodle.git MDL-15139 - Cannot create Random Short Answer questions becuase the validation code is buggy. Fix thanks to Paul-Andre Chasse. --- 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; } - } ?>