MDL-29400 assignment: Require a file to be uploaded in form
authorDan Poltawski <dan@moodle.com>
Mon, 19 Mar 2012 03:41:39 +0000 (11:41 +0800)
committerSam Hemelryk <sam@moodle.com>
Sun, 25 Mar 2012 22:19:57 +0000 (11:19 +1300)
Don't display 'File uploaded successfully' when no file uploaded for
both upload and uploadsingle

mod/assignment/type/upload/upload_form.php
mod/assignment/type/uploadsingle/upload_form.php

index ecfa5d3..df12a01 100644 (file)
@@ -28,6 +28,7 @@ class mod_assignment_upload_form extends moodleform {
 
         // visible elements
         $mform->addElement('filemanager', 'files_filemanager', get_string('uploadafile'), null, $instance['options']);
+        $mform->addRule('files_filemanager', get_string('uploadnofilefound'), 'required', null, 'client');
 
         // hidden params
         $mform->addElement('hidden', 'contextid', $instance['contextid']);
index 0a79a85..1edb37e 100644 (file)
@@ -30,6 +30,7 @@ class mod_assignment_uploadsingle_form extends moodleform {
         //$mform->addElement('filemanager', 'newfile', get_string('uploadafile'));
         //$mform->addElement('filemanager', 'files_filemanager', get_string('uploadafile'), null, $instance['options']);
         $mform->addElement('filepicker', 'assignment_file', get_string('uploadafile'), null, $instance['options']);
+        $mform->addRule('assignment_file', get_string('uploadnofilefound'), 'required', null, 'client');
 
         // hidden params
         $mform->addElement('hidden', 'contextid', $instance['contextid']);