Hi,
I'm re-using an old form from the SilverStripe tutorial in the latest version (3.1) but am getting an intermittent error.
[User Deprecated] SSTemplateParser->ClosedBlock_Handle_Control is deprecated. is deprecated. Use or instead. Called from SSTemplateParser->ClosedBlock__finalise.
This is the code that I'm using. Any ideas?
<?php
class ContactPage extends Page {
}
class ContactPage_Controller extends Page_Controller {
public static $allowed_actions = array('Form');
public function Form() {
$fields = new FieldList(
new TextField('Name'),
new EmailField('Email'),
new TextareaField('Message')
);
$actions = new FieldList(
new FormAction('submit', 'Submit')
);
$validator = new RequiredFields('Name', 'Email', 'Message');
return new Form($this, 'Form', $fields, $actions, $validator);
}
public function submit($data, $form) {
$email = new Email();
$email->setTo('email@address.co.uk');
$email->setFrom($data['Email']);
$email->setSubject("Contact Message from {$data["Name"]}");
$messageBody = "
<p><strong>Name:</strong> {$data['Name']}</p>
<p><strong>Message:</strong> {$data['Message']}</p>
";
$email->setBody($messageBody);
$email->send();
return array(
'Content' => '<p>Thank you for your feedback.</p>',
'Form' => '<p>Thank you for your feedback.</p>'
);
}
}