Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

NOMDL resource: fixed client side validation for file resource location

This was spotted during the work on MDL-21382. Without this fix, the
Location field is not validated against empty values.
  • Loading branch information...
commit b803fa1628fc4a38502764b2df71d270423d5955 1 parent 82b7f70
@mudrd8mz mudrd8mz authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 mod/resource/type/file/resource.class.php
View
7 mod/resource/type/file/resource.class.php
@@ -734,8 +734,11 @@ function setup_elements(&$mform) {
$mform->addElement('choosecoursefile', 'reference', get_string('location'), null, array('maxlength' => 255, 'size' => 48));
$mform->setDefault('reference', $CFG->resource_defaulturl);
- $mform->addGroupRule('reference', array('value' => array(array(get_string('maximumchars', '', 255), 'maxlength', 255, 'client'))));
- $mform->addRule('name', null, 'required', null, 'client');
+ $referencegrprules = array();
+ $referencegrprules['value'][] = array(get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
+ $referencegrprules['value'][] = array(null, 'required', null, 'client');
+ $mform->addGroupRule('reference', $referencegrprules);
+ $mform->addRule('reference', null, 'required', null, 'client');
if (!empty($CFG->resource_websearch)) {
$searchbutton = $mform->addElement('button', 'searchbutton', get_string('searchweb', 'resource').'...');
Please sign in to comment.
Something went wrong with that request. Please try again.