Hi Guys,
This has me stumped. Just thought I would ask here before I try to work on a work around.
I have a very simple form below that I am trying (had a much more complex form and it gave the error so I have dumbed it down and I'm still getting the error).
Anyway, anytime I try to display the form like
http://domain.com/AddItemPage/MyForm
I get the screen
Security token doesn't match, possible CSRF attack.
Am I just brain dead this morning and missing something glaringly obvious?
Thanks in advance for the help.
Cheers,
Colin
<?php
class AddItems extends Page {
public static $db = array(
);
public static $has_one = array(
);
static $icon = "cms/images/famfam-silk/application_view_list";
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab("Root.Content.Main", "Content");
return $fields;
}
}
class AddItems_Controller extends Page_Controller {
public function init() {
parent::init();
}
//add our 'show' function as an allowed URL action
public static $allowed_actions = array(
'MyForm'
);
/**
* Create a form with just a single field.
*
*/
public function MyForm() {
$fields = new FieldSet(
new TextField('Title', '<span class="required"></span>Title')
);
$actions = new FieldSet(
new FormAction(
'doSave',
_t('MyForm.SAVE', 'Save')
)
);
$validator = new RequiredFields(
'Title'
);
$form = new Form(
$this,
'MyForm',
$fields,
$actions,
$validator // optional
);
return $form;
}
public function doSave() {
die('In doSave');
}
public function doDelete() {
die('In doDelete');
}
}