How do I include a userform i have created on page.php?
In silverstripe 3 i used to use the below code in the pageContoller but it no longer works in SS4.
I know that UserDefinedForm_Controller is now UserDefinedFormController but i still get errors
function ShowForm(){
$get = DataObject::get_one('SiteTree', "URLSegment = 'contact-us'");
return new UserDefinedForm_Controller($get);
}
I’m also trying to do something similar. In SS3 I was simply able to subclass the user forms page type to have the form appear within a page.
Worked nicely, but with upgrade to SS4.2.1, the form will work fine until I run the next dev/build, then page containing forms appears ‘modified’ in CMS and loses all its form fields. Inspecting the database via phpmyadmin, I can see that all the parent classes get reset for the EditableFormFields and UserDefinedForm_EmailRecipients.
Not quite sure whether I’m using it wrong or it’s a bug?