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 = 'myemail@gmail.com';
        $email->subject = 'Publication Request';
        $email->body    = 'Your requested publication is attached.';

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

After my changes, this worked:

value="psychEmail/publication/pubRequest"
| improve this answer | |

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.