default userpic

Comment preview doesn't work for anon users

Vote 0 Votes

Something is amiss in my preview comment template. Anon users are not shown the captcha box on the preview comment page and thus always results in an error. Users logged in via openid don't see the captcha on either and works. I'm not sure what is wrong, but I suspect a javascript is missing. There are some onfocus calls, but I don't see what it is calling too. I tried copying the javascript that from the comment page to the preview page, but when the comment text is now put in the textarea box. I'm missing something. Here is my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
<head>
    <script type="text/javascript">
    /* <![CDATA[ */
    var user = <$MTUserSessionState$>;
    var is_preview = true;
    /* ]]> */
    </script>
    <$mt:include module="HTML Head"$>
    <title><$MTBlogName encode_html="1"$>: Previewing your Comment</title>
</head>
<body id="<$mt:BlogTemplateSetID$>" class="mt-comment-preview <$MTVar name="page_layout"$>" onload="mtEntryOnLoad()">
    <div id="container">
        <div id="container-inner">


<$mt:include module="Banner Header"$>


<div id="content">
<div id="content-inner">


<div id="alpha">
<div id="alpha-inner">


<h1 id="page-title" class="alt-title">Previewing your Comment</h1>

<div id="comments" class="comments" style="margin-left: 55px;">
<mt:ignore><!-- Comment Preview --></mt:ignore>
<div id="comment-<$MTCommentID$>" class="comment<mt:IfCommentParent> comment-reply</mt:IfCommentParent><mt:IfCommenterIsEntryAuthor> comment-by-author</mt:IfCommenterIsEntryAuthor>">
<div class="inner">
<div class="comment-content">
<div class="comment-content-inner">
<$MTCommentBody$>
</div>
</div>
<div class="comment-header">
<div class="asset-meta">
<span class="byline">
<$MTCommentAuthorIdentity$>
<mt:IfCommentParent>
<span class="vcard author"><$MTCommentAuthorLink$></span> replied to <a href="<mt:CommentParent><$mt:CommentLink$></mt:CommentParent>">comment from <mt:CommentParent><$MTCommentAuthor$></mt:CommentParent></a>
<mt:else>
<span class="vcard author"><$MTCommentAuthorLink$></span>
</mt:IfCommentParent>
| <a href="<$mt:CommentLink$>"><abbr class="published" title="<$MTCommentDate format_name="iso8601"$>"><$MTCommentDate$></abbr></a>
<MTIfCommentsAccepted>
| <$MTCommentReplyToLink$>
</MTIfCommentsAccepted>
</span>
</div>
</div>
</div>
</div>


<mt:ignore><!-- Comment Form --></mt:ignore>
</div>
<div class="comments-open" id="comments-open">
<h2 class="comments-open-header">Leave a comment</h2>
<div class="comments-open-content">
<div id="comment-greeting"></div>
<form method="post" action="<$MTCGIPath$><$MTCommentScript$>" name="comments_form" id="comments-form" onsubmit="return mtCommentOnSubmit(this)">
<div id="comments-form-inner">
<input type="hidden" name="static" value="1" />
<input type="hidden" name="armor" value="1" />
<input type="hidden" name="preview" value="" />
<input type="hidden" name="entry_id" value="<$MTEntryID$>" />
<input type="hidden" name="__lang" value="<$MTBlogLanguage$>" />
<mt:IfCommentParent>
<input type="hidden" name="parent_id" value="<$mt:CommentParentId$>" id="comment-parent-id">
</mt:IfCommentParent>
<div id="comments-open-data">
<div id="comment-form-name">
<label for="comment-author">Name</label>
<input id="comment-author" name="author" size="30" value="<$MTCommentAuthor encode_html="1"$>" onfocus="mtShowCaptcha()" />
</div>
<div id="comment-form-email">
<label for="comment-email">Email Address</label>
<input id="comment-email" name="email" size="30" value="<$MTCommentEmail encode_html="1"$>" onfocus="mtShowCaptcha()" />
</div>
<div id="comment-form-url">
<label for="comment-url">URL</label>
<input id="comment-url" name="url" size="30" value="<$MTCommentURL encode_html="1"$>" onfocus="mtShowCaptcha()" />
</div>
</div>
<mt:IfCommentParent>
<div id="comment-form-reply">
<input type="checkbox" id="comment-reply" name="comment_reply" value="<$mt:CommentParentId$>" checked="checked" onclick="mtSetCommentParentID()" />
<label for="comment-reply" id="comment-reply-label">Replying to comment from <mt:CommentParent><$MTCommentAuthor$></mt:CommentParent></label>
</div>
</mt:IfCommentParent>
<div id="comments-open-text">
<label for="comment-text">Comments <MTIfAllowCommentHTML>(You may use HTML tags for style)</MTIfAllowCommentHTML></label>
<textarea id="comment-text" name="text" rows="15" cols="50" onfocus="mtShowCaptcha()"><$MTCommentBody autolink="0" sanitize="0" convert_breaks="0" encode_html="1"$></textarea>
</div>
<div id="comments-open-captcha"></div>
<div id="comments-open-footer">
<input type="submit" accesskey="v" name="preview_button" id="comment-preview" value="Preview" onclick="this.form.preview.value='1';" />
<input type="submit" accesskey="s" name="post" id="comment-submit" value="Submit" />
<input type="button" name="cancel" id="comment-cancel" value="Cancel" onclick="window.location='<$MTEntryPermalink$>'" />
</div>
</div>
</form>
</div>
</div>
</div>
</div>


<$MTInclude module="Sidebar"$>


</div>
</div>


<$mt:include module="Banner Footer"$>


</div>
</div>
<div id="overlay"></div>
<div id="dialog"><div id="dialog-inner">
<div id="dialog-content"></div>
<a href="javascript:dialogClose();" id="dialog-close">Close</a>
</div></div>
</body>
</html>


Reported on Movable Type 4.2

4 Replies

| Add a Reply

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1773 6162

Last Topic: Excluding categories from blog by kholechek on Feb 9, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1429 5077

Last Topic: What apocalypse hit this community in the middle of 2011? by 75th on Feb 10, 2012

695 2910

Last Topic: Insert Image / File Fails by Russ Miller on Feb 10, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

173 737

Last Topic: About the MT version stated in HTML source by Alex E. Schneider on Feb 7, 2012

190 567

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 720

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012