Hello!
The below code throws two errors which I am having trouble with. The first is in the GetEntrant function. If I have the $data and $form variable defined in the circle brackets - I get an error saying "FATAL ERROR: Missing argument 2 for DrawPrizePage_Controller::GetEntrant()" for both the $data and $form variable.
The second and more important "problem" I have is getting the value from a database object. I am trying to get the MemberDataID value into a variable, from the Competitions table. It is commented in the code below.
class DrawPrizePage_Controller extends Page_Controller {
function Form() {
return new Form($this, "Form",
new FieldSet(
new TextField("CompID", "Competition Page ID")
),
new FieldSet(
new FormAction("GetEntrant", "Draw Winners!")
));
}
function GetEntrant($data, $form) {
$CompID = $this->data['CompID'];
$GetEntry = DataObject::get_one("Competition", "CompetitionPageID='{$CompID}'");
$WinnersDetails = DataObject::get_one("Member", "ID='{$GetEntry->MemberDataID}'"); // How do I get the value for the MemberDataID column which is called in $GetEntry above?
return $WinnersDetails;
}
:)