Moodleform element url has hardcoded id in filepicker

Moodleform element url has hardcoded id in filepicker

by Christoph Stadlbauer -
Number of replies: 0

I was trying to add an input for an external ressource to a question edit form.

In analogy to mod_url I tried the following:

$mform->addElement('url', 'ggbturl', get_string('ggbturl', 'qtype_geogebrasimple'), array('size' => '60'), array('usefilepicker' => true));
$mform->setType('ggbturl', PARAM_RAW_TRIMMED);

This works fine as long as the elementname is "externalurl" but as soon as I change it,...

I'm not sure if this is the thing to do, but if so then the hardcoded "id_externalurl" in url.js is preventing renaming of the formelement.

If this is not a bug, I'd be happy if anyone points me to the correct way of getting an external url from a repository (apart from changing the name of the element), else the really small attached patch is working for me.

Christoph

Average of ratings: -