MDL-29400 assignment: Require a file to be uploaded in form

Don't display 'File uploaded successfully' when no file uploaded for
both upload and uploadsingle
This commit is contained in:
Dan Poltawski 2012-03-19 11:41:39 +08:00 committed by Sam Hemelryk
parent 991b3a3a9b
commit 17e2b27d31
2 changed files with 2 additions and 0 deletions

View 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']);

View 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']);