Dear fellow SilverStripe users,
I've got trouble reusing a form: I have a "contact us" page created using the userforms module (SilverStripe 2.3.0-rc2). This works as intended. This particular "contact us" page shall now be reused on —meaning inserted at the bottom of— several landing pages including the actual contact form which had been defined in the CMS.
My LandingPage.php looks like:
<?php
class LandingPage extends Page {
static $db = array();
static $has_one = array(
'Kontaktformular' => 'UserDefinedForm'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TreeDropdownField('KontaktformularID', 'Bitte wählen Sie eine Kontaktseite aus, die am Ende dieser Seite eingeblendet werden soll', 'SiteTree'), 'Content');
return $fields;
}
}
class LandingPage_Controller extends Page_Controller {}
?>
And my LandingPage.ss looks like:
<div id="content" class="typography">
$Content
$Form
<% control Kontaktformular %>
$Content
$Form
<% end_control %>
</div>
But SilverStripe prints the $Content of Kontaktformular (the referenced "contact us" page) only. The $Form inside <% control Kontaktformular %> returns nothing. So the (userforms) form is missing!
Do you have an idea what I did wrong?
Regards,
Gert
P.S.
I tried $has_one = array('Kontaktformular' => 'Page') and $has_one = array('Kontaktformular' => 'SiteTree') as well. But that didn't help at all.