Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Christie 6 posts 26 karma points
    Mar 09, 2012 @ 21:11
    Christie
    0

    Getting javascript error when in IE, when adding post or topic

    Things are working ok in Firefox, but when I try to add a topic or post a reply in Internet Explorer, I see the "posting your reply" message, but it never refreshes to show the new post. Instead I get the javascript error:

    Message: Object doesn't support this property or method
    Line: 2
    Char: 21482
    Code: 0
    URI: https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js

     

    I'm using Umbraco version 4.7.1, nForum version 1.5, and have moved the Forum to be directly beneath my Home page.

    Any help would be great!

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 10, 2012 @ 09:38
    Jan Skovgaard
    0

    Hi Christie

    Not that I'm an nForum expert but I'm thinking it might be worth to try seeing if script error also occur in other browsers even though things seems to be working fine? Try checking the firebug console to see if it reports any errors perhaps? Also in IE9 you should be able to activate the developer tools where it should be possible to get some more information about the error.

    The above could be caused by anything really...most likely a codeblock missing a sign somewhere like ";" for instance.

    /Jan

  • Rory 59 posts 84 karma points
    Mar 14, 2012 @ 18:16
    Rory
    0

    Hi Christie

    I have same problem and Lee said it was an Internet Explorer issue with the Javascript. He hasn't been able to fix it yet.

    Please let me know if you find a solution as I have given up hope!

    thanks

    Rory

  • Christie 6 posts 26 karma points
    Mar 14, 2012 @ 22:13
    Christie
    0

    I'm glad to hear someone is having the same issue. I haven't been able to figure it out. I did validate my HTML with Firefox and there were no errors. And I reverted back to the master page that came with the Forum and the error still exists.

    I downloaded the uncompressed version of jquery 1.7.1 and it errors out on line 1679:

    if ( !id ) {// Only DOM nodes need a new unique ID for each element since their data

    // ends up in the global cacheif ( isNode ) {

    elem[ internalKey ] = id = ++jQuery.uuid;

     

    But I haven't been able to figure out why. I'm not sure we'll be able to implement this if it doesn't work in IE :(  Hoping to figure something out!

  • Christie 6 posts 26 karma points
    Mar 14, 2012 @ 23:10
    Christie
    0

    ok, i believe I've figured it out. I had to remove the .delay() call from two places in nforumgeneral.js file. I did this in the sections regarding btnsubmittopic and btnsubmitpost.

    The line was: var returnUrl = $("value", data).delay(3000).text();

    And I just removed the .delay(3000)   I don't think it was actually doing anything anyway.  Let me know if this works for you too!

    So now it looks like:

        // Create a new topic
        $(".btnsubmittopic").click(function (event) {
            event.preventDefault();
            var catid = $(this).attr('rel');
            var sbody = tinyMCE.get('txtPost').getContent();
            var stitle = $('#tbTopicTitle').val();
            var sticky = $('#cbSticky').is(':checked');
            var locked = $('#cbLockTopic').is(':checked');
            $('.createnewtopicform').remove();
            $('.postsuccess').show();
            // Yes this is qualified on the server side, so don't even bother!
            $.post("/base/Solution/NewForumTopic/" + catid + ".aspx",
          { "postcontent": sbody, "posttitle": stitle, "poststicky": sticky, "postlocked": locked },
        function (data) {
            // Add a little delay to help examine catch up
            var returnUrl = $("value", data).text();
            window.location.href = returnUrl;
            //window.location.reload();
        });
           
        });

  • Rory 59 posts 84 karma points
    Mar 15, 2012 @ 11:06
    Rory
    0

    Hi, thanks for that, but it hasn't fixed the problem :-(

    The Javascript for this forum works ok in IE though, so maybe we can use that to figure it out? I'm a bit clueless when it comes to Javascript as I'm a VB programmer!

    cheers

    Rory

  • Rory 59 posts 84 karma points
    Mar 15, 2012 @ 11:21
  • Christie 6 posts 26 karma points
    Mar 15, 2012 @ 14:05
    Christie
    0

    The only other thing I'd suggest is to make sure you cleared your browser cache so that it picks up the new javascript file that you modified with the changes. And in IE you can use Developer Tools to look at the script files it's loaded to make sure it's picked up the new code as well. It doesn't always update the js files immediately.

    Also, I'm testing in IE8 (don't have IE9 installed on this dev machine yet)

  • Lee 1130 posts 3088 karma points
    Mar 15, 2012 @ 14:43
    Lee
    0

    The delay is there just to help Examine catch up, to be honest if you are using the latest version of examine you shouldn't need it.

    I don't think removing the delay is the issue, as I didn't have that in the previous version and IE wouldn't play ball then - I'm hoping to have some time in a few weeks and I'll take another look at it.  

    From memory its something to do with the window.location call and IE not liking it.

  • Christie 6 posts 26 karma points
    Mar 15, 2012 @ 15:39
    Christie
    0

    Just tested my change in IE9 and it worked for me there as well. Oh well, was hoping it would help you guys out too. At least I've got it working now and can implement it for my client...

  • Bex 444 posts 555 karma points
    Mar 19, 2012 @ 18:00
    Bex
    0

    Anyone solve this..? I getting same on all versions of IE and removing delay doesn't work for me.

    Error I am getting is:

    Object doesn't support this property or method 
    jquery.min.js, line 2 character 21488
  • Bex 444 posts 555 karma points
    Mar 20, 2012 @ 17:06
    Bex
    0

    Ok, I have been trying to debug the javascript and I can bypass the error in IE on the submitting a new post (Lee you might want to tell me what probs this may be causing that I am not seeing?)

    in nForumgneral on the   $(".btnsubmitpost").click(function (event) {

    I have updated the $.post  part so it has a try catch like this:

     

      $.post("/base/Solution/NewForumPost/" + topicid + ".aspx",
      { "postcontent": sbody },
    function (data) {
       try {
           // Add a little delay to help examine catch up
           var returnUrl = $("value", data).text();
           window.location.href = returnUrl;
           //window.location.reload();
       } catch (err) {
           //alert(err);
           window.location.reload();
       }
    });

    I have also removed the delays... if it throws an error on the post I just reload the page (same as hitting F5) and seems to work.

    Bypassing the error on the new topic isn't so easy especially as it's suddenly started working, as it did the last time I tried to fix it earlier.
    There seems to be no apparent reason for this, other than if you post enough stuff it starts working. 

    Anyone got any further?

    Bex 

     

  • Bex 444 posts 555 karma points
    Mar 21, 2012 @ 10:17
    Bex
    1

    Ok, I may be talking to my self here, but I think I have fixed this.

    So if anyone else is having this problem try this:

    in the nforumgeneral.js file update the 

    $(".btnsubmitpost").click

    $(".btnsubmittopic").click

    so the anonymous function within them that reloads or redirects the page is a separate function like this:   

        // Create a new post
        $(".btnsubmitpost").click(function (event) {
            event.preventDefault();
           var topicid = $(this).attr('rel');
           var sbody = tinyMCE.get('txtPost').getContent();
           $('.topicpostlistnewpost').remove();
           $('.postsuccess').show();
           // Yes this is qualified on the server side, so don't even bother!
           $.post("/base/Solution/NewForumPost/" + topicid + ".aspx", { "postcontent": sbody }, redirect);
        });   
        // Create a new topic
        $(".btnsubmittopic").click(function (event) {
           event.preventDefault();
           var catid = $(this).attr('rel');
           var sbody = tinyMCE.get('txtPost').getContent();
           var stitle = $('#tbTopicTitle').val();
           var sticky = $('#cbSticky').is(':checked');
           var locked = $('#cbLockTopic').is(':checked');
           $('.createnewtopicform').remove();
           $('.postsuccess').show();
           // Yes this is qualified on the server side, so don't even bother!
           $.post("/base/Solution/NewForumTopic/" + catid + ".aspx",
      { "postcontent": sbody, "posttitle": stitle, "poststicky": sticky, "postlocked": locked },
    redirect);
    });
    function redirect(data) {
       var returnUrl = $("value", data).text();
       window.location.href = returnUrl;

     

    This appears to have fixed it, but I have been having the problem intermittently so I'm only 99%. I think the reason for it is that it doesn't like doing a page redirect or reload within an ajax postback and separating them out takes it out of the ajax call.

    HTH someone.

    Bex

     

  • Rory 59 posts 84 karma points
    Mar 21, 2012 @ 10:32
    Rory
    0

    Bex, no you've not been talking to yourself...I've been listening to every word but have not had anything worthwhile to say until now.

    Your solution appears to have fixed it for me too!!!!

    Thank you so much :-)

    cheers, and have a splendid day,

    Rory

  • Bex 444 posts 555 karma points
    Mar 21, 2012 @ 10:39
    Bex
    0

    Fantastic!
    If Lee's listening after we've both been using it a while and are 100% on it maybe he can update the package.. been a frustrating couple of days! :)

  • Lee 1130 posts 3088 karma points
    Mar 21, 2012 @ 10:41
    Lee
    0

    I am listening, and will update for v1.6 if its confirmed as the fix :)  Well done Bex :)

  • Rory 59 posts 84 karma points
    May 23, 2012 @ 19:34
    Rory
    0

    Lee, Bex...

    just to confirm that Bex's fix is still up and running without any errors on a live production server now. I would be happy to recommend it to be part of the v1.6 update.

    Nice one!

    cheers

    Rory

  • Bex 444 posts 555 karma points
    May 24, 2012 @ 09:43
    Bex
    0

    Rory,Lee

    Same here.. been running on our live server for the past 2 months with no problems reported.

  • Rudi Moritz 8 posts 28 karma points
    May 29, 2012 @ 06:36
    Rudi Moritz
    0

    Hi Bex,

    Your solution has saved my IE issues, but not my Chrome (19.0) or Firefox (12.0) ones. Nothing seems to happen when I click "Create Topic". Digging through with Firebug, I can see that the js fails in the line "var sbody = tinyMCE.get('txtPost').getContent();". Setting up watch expressions, I see that there is a tinyMCE object, but tinyMCE.activeEditor is null, and tinyMCE.get('txtPost') is undefined.

    I searched online already, incl the tinymce site, but couldn't get a hint.

    Any help would be appreciated,

    Rudi

    [Edit] ... I posted this comment from Chrome originally, and the browser is still showing me "Posting your reply". Browsing to the page in Firefox and IE shows me that it went through though. Funny eh?

  • Bex 444 posts 555 karma points
    May 29, 2012 @ 17:53
    Bex
    0

    Hi Rudi

    The symptoms you are explaining sound similar to the problem I had but unfortuantely I have no other suggestions.
    Maybe Lee has an idea? 

    Sorry..

    Bex

  • Rudi Moritz 8 posts 28 karma points
    May 29, 2012 @ 23:04
    Rudi Moritz
    0

    Hi Bex,

    Thanks a lot for your response, much appreciated ... and thanks for your solution above, forgot to mention that yesterday :).

    I have a feeling these issues are tinyMCE related, so I might concentrate on digging through their site more deeply now. Will update here if I find anything helpful.

    Rudi

  • Peter 89 posts 160 karma points
    Jun 05, 2012 @ 16:11
    Peter
    0

    Thanks Bex!

    I did as you suggested and works a treat.

  • Paul Fowles 75 posts 184 karma points
    Jul 23, 2012 @ 17:31
    Paul Fowles
    0

    Hi don't know if anyone is still subscribe to this forum topic but I keep missing a rel tag in Internet Explorer in the create topic and submit post buttons. Its IE specific as I've tried out my site in chrome and firefox and rel tag exists in those browsers. Any ideas please post here or at this topic

    Thanks 

  • Paul Fowles 75 posts 184 karma points
    Jul 26, 2012 @ 12:14
    Paul Fowles
    0

    Actually I forgot to add Chrissie solution with Bex's removing the delays is very important

  • trfletch 598 posts 604 karma points
    Jul 27, 2012 @ 12:26
    trfletch
    0

    Hi all,

    I am running an Umbraco 4.7.2 site and I am also having a similar issue. I was in fact having the same issue but I used Bex's fix and everything seemed to work ok. I have now copyied my site to my live server and now I have an issue creating a new topic (creating replys to posts works fine).

    When I try and create a topic it just sits on the "Creating your topic.." screen, if I look in the backend I can see that it appears to have created the "Forum Post" and the "Forum Topic" but it hasn't published them properly, they both have # as their "Link to document". If I look in the UmbracoLog table I can see 3 errors that all say "Couldn't find any page with the nodeId = 0. This is most likely caused by the page isn't published! Parameter name: nodeId".

    To test I tried commenting out the following code in nForumBaseExtensions.cs:

                            // Create the post
                            var p = Document.MakeNew(topicTitle, DocumentType.GetByAlias("ForumPost"), u, t.Id);                        // Add the document properties
                            p.getProperty("forumPostContent").Value = Helpers.HtmlEncode(Helpers.GetSafeHtml(tbPost));
                            p.getProperty("forumPostOwnedBy").Value = loggedInMember.contactId;
                            p.getProperty("forumPostKarma").Value = 0;
                            p.getProperty("forumPostIsTopicStarter").Value = 1;
                            p.getProperty("forumPostParentID").Value = t.Id;
                            p.sortOrder = 0;

                            // Now the post is created, use the id for the latest post Id
                            //t.getProperty("forumTopicLastPostID").Value = p.Id;

                            // publish application node
                            p.Publish(u);
                            // update the document cache so its available in the XML
                            library.UpdateDocumentCache(p.Id);

    With the above commented out it would successfully create the topic and reload the page, it would of course not create the post in the topic. It almost seems to me that by the time it runs the above code it hasn't quite completed the creation and updating of the cache of the "Forum topic"? The only reason I can think that it runs ok on my development server is that it is not as powerful and therefore runs the code more slowly? Can anyone offer any suggestions or a solution because you can probably tell I am clutching at straws!

    Regards

    Tony

     

Please Sign in or register to post replies

Write your reply to:

Draft