2

Trying to work out if I’m doing something wrong with catching an event from another plugin in my plugin.

I’m trying to use amforms “onSaveSubmission” event, so, in my plugin’s init() function i have

craft()->on('amForms.onSaveSubmission', function(Event $event) {
    var_dump($event);
});

But, when I submit a form successfully, this event is triggering an error:

Internal Server Error

Property "Craft\AmFormsService.onSaveSubmission" is not defined.

The onSaveSubmission event is in /plugins/amforms/services/AmForms_SubmissionsService.php

4
craft()->on('amForms_submissions.saveSubmission', function(Event $event) {
    BusinessLogicPlugin::log(print_r($event, true));
});

Pay attention to the casing
Craft\AmForms_SubmissionsServiceamForms_submissions

https://craftcms.com/docs/plugins/hooks-and-events#listening-for-events

7
  • I've updated my question, i was wrong with what i was doing in the first instance.
    – John
    Mar 28 '16 at 15:19
  • saveSubmission not onSaveSubmission, see the linked docs article.
    – carlcs
    Mar 28 '16 at 15:21
  • Right, gotcha! However, i've updated my code to amForms.saveSubmission and i'm still getting Internal Server Error Property "Craft\AmFormsService.onSaveSubmission" is not defined.
    – John
    Mar 28 '16 at 15:42
  • Just had a quick look at the plugins source code and updated the answer to what I think should work.
    – carlcs
    Mar 28 '16 at 15:50
  • I'm not getting an error now, but also no data is being dumped. Not sure this is working either.
    – John
    Mar 28 '16 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.