Skip to content
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 fa13450 commit 05d8d4abe5b48224a01819e7c069872b7926a2a3 @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
View
1 mod/assignment/type/upload/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']);
View
1 mod/assignment/type/uploadsingle/upload_form.php
@@ -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 05d8d4a

Please sign in to comment.
Something went wrong with that request. Please try again.