Retired Documentation: You are using the documentation for version 1.7.3 which was retired in 2013. Go here for the latest version documentation or check here for your available upgrades to the latest version.
Comment Submission Form
{exp:comment:form}
{/exp:comment:form}
The comment form is created very similar to a standard web form, only you don't specify the opening and closing form tags. There are a few variables that are required in order to enable people's personal information (name, email, url, etc.) to appear in the form. Here's how the comment form is typically created:
{exp:comment:form weblog="news" preview="weblog/preview"}
{if logged_out}
<p>Name: <input type="text" name="name" value="{name}" size="50" /></p>
<p>Email: <input type="text" name="email" value="{email}" size="50" /></p>
<p>Location: <input type="text" name="location" value="{location}" size="50" /></p>
<p>URL: <input type="text" name="url" value="{url}" size="50" /></p>
{/if}
<p><textarea name="comment" cols="70" rows="10">{comment}</textarea></p>
<p><input type="checkbox" name="save_info" value="yes" {save_info} /> Remember my personal information</p>
<p><input type="checkbox" name="notify_me" value="yes" {notify_me} /> Notify me of follow-up comments?</p>
{if captcha}
<p>Please enter the word you see in the image below:</p>
<p>{captcha}<br />
<input type="text" name="captcha" value="{captcha_word}" maxlength="20" /></p>
{/if}
<input type="submit" name="submit" value="Submit" />
<input type="submit" name="preview" value="Preview" />
{/exp:comment:form}
Parameters
entry_id=
entry_id="24"
You can hard code the comment form tag to display a comment form for a specific weblog entry by its entry ID.
NOTE: This parameter takes precedence over any entry specified dynamically in the URL, so when using this parameter you will want to make sure it is clear to the user which entry the displayed comment form belongs to.
preview=
preview="weblog/preview"
This is a required parameter indicating which template should be used for comment previews. Like other "path" variables in ExpressionEngine you will use the Template Group/Template name. More on previewing can be found on the Comment Previewing page.
url_title=
url_title="my_wedding"
You can hard code the comment for tag to display a comment form for a specific weblog entry by its URL title.
NOTE: This parameter takes precedence over any entry specified dynamically in the URL, so when using this parameter you will want to make sure it is clear to the user which entry the displayed comment form belong to.
weblog=
weblog="news"
With this parameter you can specify exactly which weblog you want the submitted comment associated to. This is an important, but optional, parameter.
If you link to your comment form page using the entry's URL Title, then you are strongly encouraged to include this parameter in your tag.
Because you can have the same URL Title in different weblogs, using this parameter will ensure that the comment submitted will be associated with the correct entry. Without this parameter, it is possible that the comment could be associated with an entry in a different weblog that happens to have the same URL Title.
Notes
The conditional variable {if logged_out} allows the system to show the short form (textarea only) if the user is a logged in member. We recommend you use the form this way because if a member is logged in, their personal data is fetched automatically.
Notice the variables in the "value" form fields? These allow us to show the user's information in the form automatically if they click the "remember personal info" option.
This form should be placed on a "single-entry" type page such as a comments page, of course.
Important: As noted in the captcha section, the contents of the conditional ({if captcha}) tag will only appear if you have the CAPTCHA preference turned on for comments in the weblog the entry is associated with.