Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two plugins that I want to use in a single form. One is a Guest Entry plugin to save the data submitted in the form, and the other is a Plugin that sends an email notification when the form is submitted.

I want to use both of these in the same form but I'm not sure how. If I have

<input type="hidden" name="action" value="guestEntries/saveEntry">
<input type="hidden" name="action" value="formNotification/getForm">

It won't work since both have the name "action" and I can't change the name or the functions never get called.

What can I do to make both of them work?

share|improve this question
up vote 6 down vote accepted

It’s not possible for a form to simultaneously invoke two controller actions.

You would need to write a plugin that provides its own controller, which in turn could be used to invoke the other controller actions.

class MyPluginController
    public function actionSaveEntryAndSendNotification()
        // Save the entry

        // Send the notification

If "FormNotificationController" is already your own custom plugin, then it might make more sense to just call craft()->runController('guestEntries/saveEntry'); from the top of actionGetForm(). Or just save the entry yourself from the controller action – the Guest Entries plugin is really pretty simple; most of the heavy lifting is provided by the EntriesService - saveEntry() API.

share|improve this answer

You can't run multiple actions in one request. What you're looking to do is trigger your notification action after the entries.saveEntry event. I'm assuming that your formNotification plugin is a custom plugin that you wrote. Fortunately, events are easy:

craft()->on('entries.saveEntry', function(Event $event) {
    // Your notification code here.

The best place to add this event listener is in your plugin's init function. This is located in the main plugin file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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