I am trying to create a front-end page editing capability, and set things up so that mysite.com/page/edit would return a (secured) customized page with a form to edit the page content. the problem that i have is that when i hit submit, the page returns to the same url, and nothing gets submitted. I dont know if this is because i am submitting from a url with an action in it or what. here is the code , any help would be appreciated:
class CustomPage_Controller extends Page_Controller{
function EditPage(){
//this is called in a url, mysite.com/mypage/EditPage
if(!$this->UserIsAdmin()){
Security::permissionFailure(null);
}
$fields = $this->EditableFields(); // correctly returns fields needed in form
$actions = new FieldSet(
new FormAction('UpdatePage', 'Update')
);
$required = new RequiredFields(
"Title",
"Content"
);
$form = new Form($this, "EditPage", $fields, $actions, $required);
$newdata = array(
'Title' => 'Editing '.$this->Title,
'Content' => '',
'Form' => $form
);
return $this->customise($newdata)->renderWith(array('Page','Page'));
}
function UpdatePage($data, $form){
// ... code here, but this method never gets called...
}
}
Thanks alot,
-Chris