I'm working on a plugin and need a front-end (non CP) form that submits to one of the plugin controllers. Here's my setup:
- plugins
- portal
-- PortalPlugin.php
- controller
-- Portal_AccessController.php
Portal_AccessController.php
<?php
namespace Craft;
class Portal_AccessController extends BaseController {
protected $allowAnonymous = true;
public function actionLogin() {
echo 'Here';
}
}
I then created a front-end form by adding a new template directory in /craft/templates
:
- pro-portal
-- index.html
With index.html
containing:
<form method="post" action="" accept-charset="UTF-8">
<input type="hidden" name="action" value="portal/access/login">
<div>
<input type="text" maxlength="4">
<input type="text" maxlength="4">
<input type="text" maxlength="4">
<input type="text" maxlength="4">
</div>
<a href="{{ actionUrl('portal/access/login') }}">Test me</a>
<input class="btn submit" type="submit" value="Submit">
</form>
Hitting mydomain.com/pro-portal
displays the form. On submit it returns to /pro-portal
but with a 404 error.
I also tried creating an action link but that also results in a 404 at /index.php/actions/portal/access/login
.
I've looked through answers on similar questions and tried all the solutions but no luck. Am I overlooking something? Missing something?
$response['redirect']
and where is it coming from?