Permalink
Browse files

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
  • Loading branch information...
1 parent 991b3a3 commit 17e2b27d31b5f638f3a846dbb61d87fc7097978f @danpoltawski danpoltawski committed with Sam Hemelryk Mar 19, 2012
Showing with 2 additions and 0 deletions.
  1. +1 −0 mod/assignment/type/upload/upload_form.php
  2. +1 −0 mod/assignment/type/uploadsingle/upload_form.php
@@ -28,6 +28,7 @@ function definition() {
// 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']);
@@ -30,6 +30,7 @@ function definition() {
//$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']);

0 comments on commit 17e2b27

Please sign in to comment.