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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Add fields to PageComments form?

Go to End

9 Posts   4951 Views


Community Member, 49 Posts

4 January 2010 at 8:36pm

Edited: 05/06/2010 2:56pm

EDIT: Just to update this "answer" I wrote a tutorial on SSbits ( - Hope it helps


Let me explain what I have done, in my examples I am adding an email field. Also note that while this does manage to add the field the the CMS CTF (Complex Table Field) it fails to add it to the popup.

Here goes:
File added - CommentAdminDecorator.php (in mysite directory)


/*Copied EditForm from CommentAdmin.php version 2.3.1
    - Added Email field
class CommentAdminDecorator extends LeftAndMainDecorator  {
    public function Link(){ //had to add errors out as missing function if not
        return $this->owner->Link();
	public function MyEditForm() {//Was originally EditForm, wasn't showing in the template so I had to create my own template
		$tableFields = array(
			"Name" => _t('CommentAdmin.AUTHOR', 'Author'),
			"Comment" => _t('CommentAdmin.COMMENT', 'Comment'),
			"CommenterEmail" => _t('CommentAdmin.COMMENTEREMAIL', 'Email'),
			"PageTitle" => _t('CommentAdmin.PAGE', 'Page'),
			"CommenterURL" => _t('CommentAdmin.COMMENTERURL', 'URL'),
			"Created" => _t('CommentAdmin.DATEPOSTED', 'Date Posted')
		$popupFields = new FieldSet(
			new TextField('Name', _t('CommentAdmin.NAME', 'Name')),
			new TextField('CommenterEmail', _t('CommentAdmin.COMMENTEREMAIL', 'Email')),
			new TextField('CommenterURL', _t('CommentAdmin.COMMENTERURL', 'URL')),
			new TextareaField('Comment', _t('CommentAdmin.COMMENT', 'Comment'))

File added - (in templates/Includes)
<div id="form_actions_right" class="ajaxActions">

<% if MyEditForm %>
<% else %>
	<form id="Form_EditForm" action="admin/comments?executeForm=EditForm" method="post" enctype="multipart/form-data">
		<p><% _t('WELCOME1', 'Welcome to the') %> $ApplicationName <% _t('WELCOME2', 'comment management. Please select a folder in the tree on the left.') %></p>
<% end_if %>

<p id="statusMessage" style="visibility:hidden"></p>

I hope this helps! If anyone comes up with why my popup isn't picking up the field please let me know!


Go to Top