1

I have seen a number of different paths, but, it is a bit confusing to me. What should be in my value in the HIDDEN input action below?

I have a twig page at my root:

<form method="post" action="" accept-charset="UTF-8">
    <input type="hidden" name="action" value="psychEmail/pubRequest">

    <!-- ...-->

    <input class="btn submit" type="submit" value="{{ 'Submit'|t }}">
</form>

and then I have a plugin PsychEmailPlugin.php class file with class PsychEmailPlugin extends BasePlugin

and then I have a controllers subdirectory with a PsychEmailController.php file that contains an action:

class PsychEmailController extends BaseController
{
    public function actionPubRequest($emailAddress)
    {
        $email = new EmailModel();
        $email->fromEmail = $emailAddress;
        $email->toEmail = '[email protected]';
        $email->subject = 'Publication Request';
        $email->body    = 'Your requested publication is attached.';

        craft()->email->sendEmail($email);
    }
}
1
  • After some reading I changed my controller to PsychEmail_PublicationController. php, but, I am still having issues with the path.
    – Chip Shank
    Commented Apr 21, 2017 at 19:42

1 Answer 1

1

After my changes, this worked:

value="psychEmail/publication/pubRequest"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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