I have a form which relates to a PageType called GarmentPage. When the user submits the form it sends the associated ID variable as a URL variable (/blahblah?id=x)
I have a method in my new extended userform class which is supposed to take this ID and return a data object of that particular GarmentPage page - so then on the page which displays the form I can output details from the object's variables.
Here is the code for the method in the userform controller:
class UserDefinedFormGarment_Controller extends UserDefinedForm_Controller {
function OutputGarmentDetails() {
$newID = $_GET['id'];
return DataObject::get_one("GarmentPage", "GarmentPage.ID == $newID");
}
}
This results in a warning "Unknown class passed as parameter". The $newID is correctly set with the ID of the corresponding GarmentPage object.
What am I doing wrong here? Is there a better way to do this?
Also, I'm not quite sure of the best way to output the object's variables in the template corresponding to the form output. I can use something like the following?...
<% control OutputGarmentDetails %>
<p>$Variable1</p>
<% end_control %>
Thanks guys!