Skip to content

Instantly share code, notes, and snippets.

@marinaglancy
Last active Apr 24, 2019
Embed
What would you like to do?
Test for the forms id conflict bug
<?php
require_once(__DIR__ . '/config.php');
require_once($CFG->libdir.'/formslib.php');
require_login();
$PAGE->set_url(new moodle_url('/testform.php'));
$PAGE->set_context(context_system::instance());
class testform extends moodleform {
public function definition()
{
$mform = $this->_form;
$mform->addElement('course', 'courseid');
$this->add_action_buttons();
}
}
$form1 = new testform(null, null, 'post', '', ['data-random-ids' => 1]);
$form2 = new testform(null, null, 'post', '', ['data-random-ids' => 1]);
echo $OUTPUT->header();
$form1->display();
$form2->display();
echo $OUTPUT->footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment