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.

Data Model Questions

Form submission: Automatic blank page created in admin




4 November 2009 at 2:45am (Last edited: 4 November 2009 6:52pm), Community Member, 15 Posts

i have created form submission page like "contact page" please find the code below. while i submit form it automatically one blank page created in admin sitetree. i have no luck to find the error, big strange for me. any help me to find this solution it very useful to me

* Defines the ContactPage page type

class ContactPage extends Page {
   static $db = array(
      'FirstName' => 'Varchar(100)', //
      'Surname'   => 'Varchar(100)',
      'Email' => 'Varchar(100)' //Text presented after submitting message
static $has_one = array(


class ContactPage_Controller extends Page_Controller {
   function Form() {
         return new Form($this, "Form", new FieldSet(
            // List your fields here
            new TextField("FirstName", "First name"),
            new TextField("Surname"),
            new EmailField("Email", "Email address")
         ), new FieldSet(
            // List the action buttons here
            new FormAction("SignupAction", "Sign up")
         ), new RequiredFields(
            // List the required fields here: "Email", "FirstName"

   function SignupAction($data, $form) {

      // Create a new Contact and load the form data into it
      $Contact = new ContactPage();

      // Write it to the database. This needs to happen before we add it to a group