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.

Form Questions /

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

Showing Custom form submissions in the CMS

Go to End

2 Posts   1182 Views


Community Member, 6 Posts

31 March 2011 at 12:06am


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?




Community Member, 80 Posts

9 May 2011 at 6:32pm

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;