Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » Showing Custom form submissions in the CMS

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

Page: 1
Go to End
Author Topic: 826 Views
  • smert
    Community Member
    6 Posts

    Showing Custom form submissions in the CMS Link to this post


    I have created a custom form that submits ot the database. I would like to view the form submissions in the CMS in the same fashion as the userform module (I need more flexibility with my form that I get with the userform module).

    Can somebody tell me what steps I need to take to get there?



  • Ben_W
    Community Member
    80 Posts

    Re: Showing Custom form submissions in the CMS Link to this post

    you would need to have a look at TableListField.

    I have a contact us form like this.

    class ContactUsSubmission extends DataObject {
       static $db = array(
          'FirstName' => 'Varchar(255)',
          'LastName' => 'Varchar(255)',
          'Email' => 'Text',
          'Comments' => 'Text',
          'Subscribe' => 'Varchar(255)'

    I then added the contact us report under the Reports tab in my ContactUsPage.

    function getCMSFields() {
          $fields = parent::getCMSFields();
          $fields->addFieldToTab('Root.Content.Main', new TextField('Headline'), 'Content');
          $fields->addFieldToTab('Root.Reports.ContactUsReport', $this->getReportField());
          return $fields;
       function getReportField() {
        $resultSet = new DataObjectSet();
        $filter = '';
        $sort = "ContactUsSubmission.ID ASC";
        $join = '';
        $instance = singleton('ContactUsSubmission');
        $query = $instance->buildSQL($filter, $sort, null, $join);
        $report = new TableListField(
              'ID' => 'ID',
              'Created' => 'Date/Time',
              'FirstName' => 'First Name',
              'LastName' => 'Last Name',
              'Email' => 'Email Address',
              'Comments' => 'Comments'
           'Email' => '<a href=\"mailto: $Email\" title=\"Email $FirstName\">$Email</a>'
           'Created' => 'Date->Nice'
        if(isset($_REQUEST['printable'])) {
        } else {
        return $report;

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.