I'm trying to put a Excel - export function behind a CMS-button, but when hitting the button, the page moves to /admin/EditForm (wich gives a 404 error). I use the following code:
class ExcelExport extends Page {
...
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Export', new FormAction('doExport', 'Export to excel'));
return $fields;
}
}
class ExcelExport_Controller extends Page_Controller {
public function doExport(){
...
FormResponse::status_message(sprintf('Export ok!' ),'good');
return FormResponse::respond();
}