bluehousegroup / silverstripe-contact-form

A contact form module for SilverStripe 3.0
11 stars 10 forks source link

Can't include Form on other page like Homepage #21

Open lastgrade opened 7 years ago

lastgrade commented 7 years ago

I have followed the instruction on readme page, to create sub-class MyContactPage form ContactFormPage, and create page on cms, and can see the form on 'url/contact' ie contact page.

When I try to include the contact form in HomePage, the form get displayed, but form action is set as 'url/home/Form' while I want the form action attritbute like 'url/contact/Form'. so that form get submitted to contact page and processed.

Below is the code from HomePage_Controller.php

public static function Form(){
    $page =  MyContactPage::get()->First();     
    if($page){
        $controller = new MyContactPage_Controller($page);
        $form = $controller->Form();
        return $form;
    }
}