Skip to main content
added 54 characters in body
Source Link
Brad Bell
  • 67.6k
  • 6
  • 75
  • 145

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.phpPsychEmailPlugin.php class file with class PsychEmailPlugin extends BasePluginclass PsychEmailPlugin extends BasePlugin

and then I have a controllers subdirectory with a PsychEmailController.phpPsychEmailController.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.';

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);
    }
}

}

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);
}

}

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);
    }
}
Source Link

How to reference controller action from hidden action? Correct path?

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);
}

}