Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
David Mudrák authored September 17, 2010

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. 7  mod/resource/type/file/resource.class.php
7  mod/resource/type/file/resource.class.php
@@ -734,8 +734,11 @@ function setup_elements(&$mform) {
734 734
 
735 735
         $mform->addElement('choosecoursefile', 'reference', get_string('location'), null, array('maxlength' => 255, 'size' => 48));
736 736
         $mform->setDefault('reference', $CFG->resource_defaulturl);
737  
-        $mform->addGroupRule('reference', array('value' => array(array(get_string('maximumchars', '', 255), 'maxlength', 255, 'client'))));
738  
-        $mform->addRule('name', null, 'required', null, 'client');
  737
+        $referencegrprules = array();
  738
+        $referencegrprules['value'][] = array(get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
  739
+        $referencegrprules['value'][] = array(null, 'required', null, 'client');
  740
+        $mform->addGroupRule('reference', $referencegrprules);
  741
+        $mform->addRule('reference', null, 'required', null, 'client');
739 742
 
740 743
         if (!empty($CFG->resource_websearch)) {
741 744
             $searchbutton = $mform->addElement('button', 'searchbutton', get_string('searchweb', 'resource').'...');

0 notes on commit b803fa1

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