Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

2.45 -> 2.46 form template problem

Go to End



Community Member, 26 Posts

11 January 2012 at 2:30pm

here is the code i have used for all my silvertripe sites up until 2.46


class EnquiryForm extends Page {

class EnquiryForm_Controller extends Page_Controller {
	function Form() {
		return new Form($this, "Form", new FieldSet(
			// List your fields here
			new TextField("Name", "Full name *"),
			new EmailField("Email", "Email address *"),
			new TextField("Phone", "Phone Number"),
			new TextareaField("Message", "Message", "3", "18")
		), new FieldSet(
			new FormAction("SubmitEnquiry", "Submit")
			new RequiredFields("Name", "Email")
	function SubmitEnquiry($data, $form) {
		$Enquiry = new Enquiry();
		$email = new Email;
		$email->to = '[email protected]'; 
		$email->from = '[email protected]';
		$email->subject = 'New Enquiry';
		$email->body = $form->forTemplate();
			// Redirect to a page thanking people for registering


now on 2.46 i get this error: Generated with the default template

I've never been able to move on to 2.46 because it breaks a lot of my templated code.
whats wrong here? and should I expect these kinds of problems with the upcoming 3.0 release?

thanks for you time,