Hoping someone with more moodle plugin and forms experience might be able to help me with this. I have a form that when a user presses a submit button I check if it has been pressed and run some code.
In my _form class I have:
$mform->addElement('submit', 'addbutton', "Add Period");
in my non_form.php page I then have after submission:
62 if ($mform->is_cancelled()) {
63 echo'Cancel button pressed';
64 } else if ($fromform = $mform->get_data()) {
65 if($fromform->addbutton =="Add Period") { ....
This all works fine but when I turn on moodle debugging I can see the following error and I am wondering if I am doing anything wrong. The error line number corresponds to line 65 above:
Notice: Undefined property: stdClass::$addbutton in /Applications/MAMP/htdocs/moodle/blocks.....
Thanks,
Gavin