Comment Submission Form

{exp:comment:form}

{/exp:comment:form}

There is one required parameter in the comment form but only if you wish to use the preview feature:

{exp:comment:form preview="weblog/preview"}

The "preview" parameter specifies the template group/template in which the preview will be shown. More on previewing can be found on the Comment Previewing page.

The comment form is created very similar to a normal 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 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>

<input type="submit" name="submit" value="Submit" />
<input type="submit" name="preview" value="Preview" />

{/exp:comment:form}

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.