Hi moodlers,
I try to build a block plugin where you can type some text and this text should be the added to some URL. My current code is like
I have a "my_form.php" containing
class myblock_form extends moodleform {
[...]
$mform->addElement('text', 'txt1', get_string('txt1', 'block_myblock'), array('rows' => 1, 'cols' => 6));
$mform->setType('txt1', PARAM_RAW);
$this->add_action_buttons($cancel = false, $submitlabel="Kurs suchen!");
}
and I have "block_myblock.php" containing
$mform = new myblock_form();
//Form processing and displaying is done here
if ($mform->is_cancelled()) {
//Handle form cancel operation, if cancel button is present on form
} else if ($data = $mform->get_data()) {
redirect(new moodle_url('Some_url_here', $data));
} else {
$this->content->text = $mform->render();
}
return $this->content;
}
But after pressing the submit button I will be redirected to "MY_MOODLE_URL/course/view.php"
How can I use the entered text?
Best,
Alex