Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Form submission: Automatic blank page created in admin

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1125 Views
  • ramu
    Community Member
    15 Posts

    Form submission: Automatic blank page created in admin Link to this post

    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


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.