Skip to content

Instantly share code, notes, and snippets.

@marinaglancy
Last active April 24, 2019 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marinaglancy/3e2a4210532edd9b7bc870616fc98315 to your computer and use it in GitHub Desktop.
Save marinaglancy/3e2a4210532edd9b7bc870616fc98315 to your computer and use it in GitHub Desktop.
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