I have a simple plugin that's expected POST data from a form:
<form method="post" action="" accept-charset="UTF-8">
<input type="hidden" name="action" value="{{ actionUrl('broadbean/jobs/new') }}">
When I submit the form, that fails:
Page Not Found
Unable to resolve the request "http:/craft.dev/index.php/admin/actions/broadbean/jobs/new".
If I cut and paste that URL into a new window, I get the plugin response, so what gives here? The plugin is set up to allow anonymous access (but I'm submitting the form from within an admin view anyway).
EDIT:
According to http://buildwithcraft.com/docs/plugins/controllers#posting-to-controller-actions I should be able to put the action URL in a hidden field, which I've done. If I dispense with that and instead put the actionUrl() directly in the form's action parameter, everything works.
Is this a bug? This is on Craft 2.2.2601.
EDIT:
Controller code:
class Broadbean_JobsController extends BaseController
{
protected $allowAnonymous = true;
public function actionNew()
{
$this->requirePostRequest();
$result = craft()->broadbean_jobs->createJob();
var_dump(array(
'message' => ($result['success']) ? Craft::t('Job created.') : Craft::t('Unable to create job.'),
'values' => craft()->request->getPost(),
'errors' => $result['errors']
));
}
}
broadBean/jobs/new
.