Forums | Mahara Community
Developers
/
Saving data
04 November 2015, 23:25
I am creating my first artefact plugin and am having trouble saving form data. On form submission I get an error message:
A nonrecoverable error occurred.
In the error log I can see:
No function registered to handle form submission for form "addstandard", referer: http://localhost/mahara.dev/artefact/standardsofcompetence/new.php
In my new.php I have the following function;
function addstandard_submit(Pieform $form, $values) {
Any help on how to fix this would be gratefully received.
Thanks,
Pete
05 November 2015, 3:23
Hi Pete,
the submit function should be within the Artefact class that you are defining in lib.php.
When I was starting with Mahara artefact programming I found looking at the Plans artefact was useful for getting a handle on artefacts and blocks types within artefacts.
Hope tis helps.
Kevin
05 November 2015, 8:49
Pete hi.
The function line looks OK, but it would be very helpful if you could provide a little more code, e.g. the definition of your form etc.
Cheers
05 November 2015, 17:15
Hm, that is odd. If your form's name is 'addstandard', then Pieforms should by default use the function 'addstandard_submit' as the submit callback method.
Perhaps there's something strange going on with the scope of the addstandard_submit() function? You didn't define it inside of an "if" block or something like that? Try putting a direct call to it right before your call to pieform() and see if it works. Like this:
addstandard_submit(null, null);
pieform($form);
Another thing you could try, is to explicitly specify the submit function:
$form = array(
// all your other form declaration stuff
'successcallback' => 'addstandard_submit',
);
Cheers,
Aaron