Hi all,
I have created a page type to show a list of Members from a specific group. I want logged in users to be able to edit their details from this page (via a controller action). But I cannot seem to find a way to display the Form by calling the 'editprofile' action on my page.
I keep getting: [User Error] Uncaught Exception: Object->__call(): the method 'handleaction' does not exist on 'Form'
What am I doing wrong?
<?php
class MembersPage extends Page {
public function Showmembers( ){
// displays a list of members
}
}
class MembersPage_Controller extends Page_Controller {
static $allowed_actions = array(
'show',
'editprofile'
);
//Displays the Panellid detail page, using Panellid_show.ss template
function show() {
// shows a single members' profile
}
//Displays the profile edit form, NOT...
function editprofile() {
$fields = new FieldSet(
new TextField('FirstName', '<span>*</span> Voornaam'),
new TextField('SurName', '<span>*</span> Achternaam'),
new EmailField('Email', '<span>*</span> Email')
);
$actions = new FieldSet(
new FormAction('SaveProfile', 'Opslaan')
);
$validator = new RequiredFields('FirstName', 'Email');
//Create form
$Form = new Form($this, 'editprofile', $fields, $actions, $validator);
//Populate the form with the current members data
$Member = Member::CurrentMember();
$Form->loadDataFrom($Member->data());
//Return the form, this throws the User Error...
return $Form;
}
}
//Save profile
public function SaveProfile($data, $form) {
// Save the profile
}
}