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.

We've moved the forum!

Please use for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Forum Module /

Discuss the Forum Module.

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

Getting error on form

Go to End

4 Posts   2375 Views


Community Member, 12 Posts

14 May 2015 at 9:00am

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?

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->setSubject("Contact Message from {$data["Name"]}"); 

        $messageBody = " 
            <p><strong>Name:</strong> {$data['Name']}</p> 
            <p><strong>Message:</strong> {$data['Message']}</p> 
        return array(
            'Content' => '<p>Thank you for your feedback.</p>',
            'Form' => '<p>Thank you for your feedback.</p>'


Community Member, 166 Posts

14 May 2015 at 9:04am

Edited: 14/05/2015 9:04am

Hi Robskinn,

I believe the tutorial you were using was out of date.
Do you have the .ss file to look at too?

I think you will find that the .ss file is using <% control %> rather than <% loop %>.



Community Member, 12 Posts

14 May 2015 at 9:52am

Edited: 14/05/2015 10:02am

Yes, I think you may be right -This is what I have in my ss file

    <% control getForm %>
    <% end_control %>

Just tested 'loop' and so far it's looking good - many thanks

    <% loop getForm %>
    <% end_loop %>


Community Member, 419 Posts

25 May 2015 at 3:01am

Judging purely by the variable names used, you probably want <% with ... %> rather than <% loop ... %>