Go to main content

Comments form



<txp:comments_form />

The comments_form tag can be used as a single tag or a container tag and is used to display a comment form. Comments will be attached to present individual article as a default, or to the article set by the id attribute.


Tag will accept the following attributes (case-sensitive) as well as the global attributes :

form="form name"
Use specified form template.
Default: comment_form.

Common presentational attributes

These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.

class="CSS class name"
HTML class to apply to the wraptag attribute value.
Default: comments_form (see class cross-reference).
HTML tag to wrap around output, specified without brackets (e.g. wraptag="p").
Default: unset (but see wraptag cross-reference for exceptions).


Example 1: Give visitors indication of ‘Comments’ status

Comments for articles can be turned on or off at the author’s discretion for any article that is published; by using the following scheme in an article form, you can still have the on/off control over comments while still giving users indication of comment status:

    <txp:comments_form />
<txp:else />
    <p>Comments are turned off for this article.</p>

Other tags used: if_comments_allowed, else.

Example 2: Display conditional comments and form

    <txp:comments form="lineitem" break="li" wraptag="ul" />
    <txp:comments_form />

And then an example of what the form lineitem could contain:

<txp:comment_id />

For the current article, returns a list of id numbers for comments and a comment input form (but only if comments are currently allowed).

Other tags used: comment_id, comments, if_comments_allowed.


Version 4.6.0

Can be used as a container tag.
msgstyle attribute deprecated.
forgetlabel, isize, msgcols, msgrows, msgstyle, previewlabel, rememberlabel and submitlabel attributes deprecated and functionality moved to individual comment_* input tags.

Version 4.5.0

Added forgetlabel, previewlabel, rememberlabel and submitlabel attributes.

Version 4.0.4

show_preview attribute removed.

If you notice any kind of problem with this page's construction or content (outdated information, typos, broken links, or whatever), open an issue to have it sorted. Or have a go at it yourself. :)