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.

Blog Module /

Discuss the Blog Module.

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

Customising the Comment Form HTML

Go to End

10 Posts   7711 Views


Community Member, 21 Posts

22 July 2009 at 2:38pm

had a look at this too
a google search for postcommentform silverstripe


Community Member, 27 Posts

11 December 2009 at 4:51am

Edited: 11/12/2009 4:53am

Copy the file /cms/templates/ to your theme's templates folder, replace:

	<% if CanPostComment %>
		<h4><% _t('POSTCOM','Post your comment') %></h4>
	<% else %>

With the following:

	<% if CanPostComment %>
		<% control PostCommentForm %>
		        <h4><% _t('POSTCOM','Post your comment') %></h4>
			<% if IncludeFormTag %>
			<form $FormAttributes>
			<% end_if %>
				<% if Message %>
				<p id="{$FormName}_error" class="message $MessageType">$Message</p>
				<% else %>
				<p id="{$FormName}_error" class="message $MessageType" style="display: none"></p>
				<% end_if %>
					<% control Fields %>
					<% end_control %>
					<div class="clear"><!-- --></div>
				<% if Actions %>
				<div class="Actions">
					<% control Actions %>
					<% end_control %>
				<% end_if %>
			<% if IncludeFormTag %>
			<% end_if %>
		<% end_control %>
	<% else %>

This is essentially pasting the contents of the default template into the overridden template inline. You should be able to then make any changes you want to make, including specifying the fields explicitly (see under "Using a custom template" for more information about what that would look like).

That's the best way I can see to do it without modifying system classes. I know this question was asked several months ago, but this is probably a common question, so hopefully it will help someone.


Go to Top