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.
This commit is contained in:
@@ -734,8 +734,11 @@ class resource_file extends resource_base {
|
||||
|
||||
$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').'...');
|
||||
|
||||
Reference in New Issue
Block a user