Forums | Mahara Community

Developers /
Saving data


anonymous profile picture
Deleted user
Posts: 1

04 November 2015, 11:25 PM

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

Kevin Rickis's profile picture
Posts: 67

05 November 2015, 3:23 AM

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

Gregor Anželj's profile picture
Posts: 348

05 November 2015, 8:49 AM

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

Aaron Wells's profile picture
Posts: 896

05 November 2015, 5:15 PM

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

4 results