Hi,
So I have noticed the following, if I place a form in a layout and will call that page directly then the form will be rendered. If I call it from another page then the form will not be displayed.
To be specific:
<?php
class ContactPage extends Page {
}
class ContactPage_Controller extends Page_Controller {
private 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')
);
return new Form($this, 'Form', $fields, $actions);
}
}
Create ContactPage.ss with $Form entry only. From a different page call $renderWith(ContactPage) will result in no table output.