Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
mudrd8mz committed Sep 17, 2010
1 parent 82b7f70 commit b803fa1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mod/resource/type/file/resource.class.php
Expand Up @@ -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').'...');
Expand Down

0 comments on commit b803fa1

Please sign in to comment.