Forums Community

These forums are dedicated to the discussion of our DotNetNuke products, such as Ultimate DNN Blog Module - SunBlogNuke & GalleryPlus.

For the benefit of the community and to keep information here helpful to everyone who visits, please observe the following posting guidelines:

  • If you are reporting a bug and strange issue please tell us which version of DNN and SunBlogNuke and share some event logs from "Admin/Event Viewer".
  • Site Moderators have the final word on approving/removing a thread or post or comment.
  • English language posting only, please.
Home/Ultimate DNN Blog Module :: SunBlogNuke/Support Issues/Comments Not Working (JS errors) with DNN9 and SBN 8.4
PreviousNext
New Post
8/4/2017 8:18 AM
 

I had asked this in email but then saw you have a support forum, so I'm reposting here.  :-)

Comments are generating an error.  When you click "submit comment" and it looks like nothing happens to the end user and there's a JS error in the console.  If you refresh the page, you can see the comment, but there's no indication the comment submitted successfully to the user.  The error in the js console is...

js:268 Uncaught Error: Syntax error, unrecognized expression:

  • http://www.gravatar.com/avatar/b642b4217b34b1e8d3bd915fc65c4452?s=32&r=R&d=identicon" alt="Test's avatar" class="avatar" width="32" height="32" /> Test said on Wednesday, August 2, 2017 9:54 PM:   
    Test comment
  • at Function.Sizzle.error (js:268) at tokenize (js:307) at select (js:342) at Function.Sizzle [as find] (js:239) at init.find (js:350) at init (js:8) at Object.jQuery (js:3) atjs:75 at Object. (js:83) at fire (js:56)

    I did some further troubleshooting and tracked down the line of code.  In this function...


    function addComment() {
                var dto = CommentWrapper.buildCommentDTO();
                CommentWrapper.Post("AddComment", dto, function(result) {
                    var annotations = JQ.$('#annotations');
                    if (CommentWrapper.settings.replyToId != -1) {
                        annotations = JQ.$('#replies_' + CommentWrapper.settings.replyToId);
                        CommentWrapper.cancelReply('');
                    }
                    JQ.$(result).appendTo(annotations).fadeTo(1000, 1);
                    CommentWrapper.resetCommentArea();
                });
            }

     

    The line JQ.$(result).appendTo(annotations).fadeTo(1000, 1); is failing.  The appendTo method is failing.  The reason seems to be that jquery is not recognizing "result" as HTML.  The variable started with a newline, and I found a Stack Overflow talking about how newer jquery versions will parse that as text and not HTML.  I did a version check and the jquery version in the console is 1.9.1.  https://stackoverflow.com/questions/14347611/jquery-client-side-template-syntax-error-unrecognized-expression

    The above shows the variable output in the console.

    If the whitespace were removed from the start of the string (newlines and spaces) it should work, I think.

     

    New Post
    8/4/2017 6:09 PM
     

    Hope it helps. You can fix it with modify the code like that:

    old:

    JQ.$(result).appendTo(annotations).fadeTo(1000, 1);
    

    modified:

    JQ.$(JQ.$.trim(result)).appendTo(annotations).fadeTo(1000, 1);
    

    Ultimate DNN Blog Module - SunBlogNuke
    New Post
    8/5/2017 12:55 AM
     

    That did the trick. I had to flush the DNN cache though (I'm guessing that's normal). Is the only file I need to update the one in DesktopModules\SunBlog\js\debug? Will this be fixed in the next release?

    New Post
    8/5/2017 9:38 AM
     

    Yes, you just need to modify the only js file and it will be included in next release soon. Thanks.


    Ultimate DNN Blog Module - SunBlogNuke
    PreviousNext
    Home/Ultimate DNN Blog Module :: SunBlogNuke/Support Issues/Comments Not Working (JS errors) with DNN9 and SBN 8.4
    Copyright © 2009-2018 Ultimate DNN Blog Module - SunBlogNuke Powered by SunBlogNuke Corp