News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SMF Preview post Fetching preview... (stucks at "Fetching preview...) ( Fixed)

Started by Indonesian, September 10, 2007, 01:36:37 AM

Previous topic - Next topic

Indonesian

I have a SMF forum setup all works fin only one small problem! Powered by SMF 1.1.3
When I write a new posting and like to preview the post before saving I have to disable JavaScript on my Browser and then it will show  the Preview of my post!
If I don't disable Java Script the Preview shows only Fetching Preview but nothing happens!

I am sure nothing is wrong with my Browser Opera because the preview in sent post works on the 110mb.com [nofollow] forum and I don't have to disable the Java Script function!

Also in your forum the Preview function works without me disabling JavaScript!

You can have a look your self and test it out if this will happen on your browser also! But the forum is a bit of a sensitive nature!  Go Here [nofollow]

Is there any setting I got wrong? Or is this a script problem?

Anyone knows what could be the problem!

Quote from:  this I get on the java error console
  Line 89 of inline#4 script in http://indonesian.10001mb.com/smfforum/index.php?action=post;msg=31;topic=30.0;sesc=6a0c6757f43bf2ec91c6160daca6b417 [nofollow]
    var i, preview = ((XMLDoc.getElementsByTagName("smf"))[0].getElementsByTagName("preview"))[0];
  Line 60 of linked script http://indonesian.10001mb.com/smfforum/Themes/default/script.js?fin11 [nofollow]
    callback(sendDoc.responseXML);
  At unknown location
    [statement source code not available]


( I am just a Newbie )and Its getting very technical but I just delete this section in the /Themes/default/script.js file! now is working the preview works and Javascript is activated!  8)
Not sure if this will give me other problems But the preview Works again!

Quote// Send a post form to the server using XMLHttpRequest.
function sendXMLDocument(url, content, callback)
{
   if (!window.XMLHttpRequest)
      return false;

   var sendDoc = new window.XMLHttpRequest();
   if (typeof(callback) != "undefined")
   {
      sendDoc.onreadystatechange = function ()
      {
         if (sendDoc.readyState != 4)
            return;

         if (sendDoc.responseXML != null && sendDoc.status == 200)
            callback(sendDoc.responseXML);
         else
            callback(false);
      };
   }
   sendDoc.open [nofollow]('POST', url, true);
   if (typeof(sendDoc.setRequestHeader) != "undefined")
      sendDoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
   sendDoc.send(content);

   return true;
}

This was a Fix!  ;D

greyknight17

Was going to ask you to replace that file instead. Try getting a new script.js file from the full install package and use that one to see if Preview is allowed.

Indonesian

Quote from: greyknight17 on September 10, 2007, 12:15:46 PM
Was going to ask you to replace that file instead. Try getting a new script.js file from the full install package and use that one to see if Preview is allowed.

I did try that used one script.js form Ver.1.13 then again from Ver.1.12 still had the same problem!

It's not nice way of doing it but Preview work and so fare all other functions are OK!
Only get this small  msg: in script error console but no problem!


Quote from:   Java Error ConsoleLine 66 of inline#4 script in http://indonesian.10001mb.com/smfforum/index.php?action=post;msg=68;topic=59.0;sesc=6cfc429b3e1309d40ccedc9bbe1566f8 [nofollow]
     sendXMLDocument(smf_scripturl + "?action=post2" + (current_board ? ";board=" + current_board : "") + (make_poll ? ";poll" : "") + ";preview;xml", x.join("&"), onDocSent);
  Line 1 of  script
     return event.ctrlKey || previewPost();
  At unknown location
    [statement source code not available]

Perfektionist

Hello!

What does the code which oestert has removed basically do?

I found out that it could also solve my problem. But doesn't it pose any harms remiving those lines?


Regards!

cme1st2302

I was having the same problem too.  Check your index.php file one line 1 in the forum root to see if there is a <title> tag before the <?.  I just removed the title tag all together and now my preview is working.

Chris
SMF Version: 1.1.11
SimplePortal Version: 2.3.2

Admin

He who waits for perfect conditions sees nothing!!
If you need help adding a button or tab PM me!!

Perfektionist

Hi Chris!

Thanks for your post. In fact there is no such tag in line 1 before "<?php"  :(

Paffman


Perfektionist

Have you read this?

In brief, I replaced a Joomla menu item that originally pointed to a relative URL by a complete URL. This solved my problem after I had investigated for several days.


Paffman

I can preview in quick reply OK, but not in the normal reply window.

Strange  :-\

Indonesian

I upgraded to 1.1.7 but still had the same problem now I finally got a good fix. Still don't know exactly why this problem persists but I guess it has something to do with the Server setting or DB redirection! Also my my forum DB backup system don't work get a server error message in my download file!

( I am just a Newbie ) getting very technical but I just delete this section in the /Themes/default/script.js file! now is working the preview works and Javascript is activated! 8)
Not sure if this will give me other problems But the preview Works again!

Definitely a cookie problem also related to head collapse will not work after this fix!


Quote from: Before// Send a post form to the server using XMLHttpRequest.
function sendXMLDocument(url, content, callback)
{
   if (!window.XMLHttpRequest)
      return false;

   var sendDoc = new window.XMLHttpRequest();
   if (typeof(callback) != "undefined")
   {
      sendDoc.onreadystatechange = function ()
      {
         if (sendDoc.readyState != 4)
            return;

         if (sendDoc.responseXML != null && sendDoc.status == 200)
            callback(sendDoc.responseXML);
         else
            callback(false);
      };
   }
   sendDoc.open [nofollow]('POST', url, true);
   if (typeof(sendDoc.setRequestHeader) != "undefined")
      sendDoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
   sendDoc.send(content);

   return true;
}

This was a Fix! ;D
Quote from: After// Send a post form to the server using XMLHttpRequest.
// Mario
//function sendXMLDocument(url, content, callback)
//{
   //if (!window.XMLHttpRequest)
      //return false;

//   var sendDoc = new window.XMLHttpRequest();
   //if (typeof(callback) != "undefined")
   //{
      //sendDoc.onreadystatechange = function ()
   //   {
      //   if (sendDoc.readyState != 4)
      //      return;

      //   if (sendDoc.responseXML != null && sendDoc.status == 200)
      //      callback(sendDoc.responseXML);
      //   else
      //      callback(false);
   //   };
   }
//   sendDoc.open [nofollow]('POST', url, true);
//   if (typeof(sendDoc.setRequestHeader) != "undefined")
   //   sendDoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
   //sendDoc.send(content);

   //return true;
//}




Now this is a good Fix and header collapse works also!
Quote
Find in
default/Post.template.php

Before:
QuotesendXMLDocument(smf_scripturl + "?action=post2" + (current_board ? ";board=" + current_board : "") + (make_poll ? ";poll" : "") + ";preview;xml", x.join("&"), onDocSent);

After:
QuotesendXMLDocument(smf_scripturl + "action=post2" + (current_board ? ";board=" + current_board : "") + (make_poll ? ";poll" : "") + ";preview;xml", x.join("&"), onDocSent);


Read this; one more option but did not work for me also don't copy directly from the&nbsp; post!
Quotehttp://www.joomlahacks.com/component/option,com_smf/Itemid,94/topic,1989.msg10370#msg10370 [nofollow]

After hours searching for bug, I get to make it working for me.
JSMF must to send 'action' and not '?action'. Be carefully with the break lines.

Make changes in Post.template:

Next line 65:
Code:

QuotesendXMLDocument(smf_scripturl + "?action=post2" + (current_board ? ";board=" + current_board : "") + (make_poll ? ";poll" : "") + ";preview;xml", x.join("&"), onDocSent);
         
document.getElementById("preview_section").style.display = "";

setInnerHTML(document.getElementById("preview_subject"), txt_preview_title);

setInnerHTML(document.getElementById("preview_body"), txt_preview_fetch);

return false;

to
Code:

QuotesendXMLDocument(smf_scripturl + "';
if (!defined( '_VALID_MOS' ))
{
echo '?action=post2';
}
else
{
echo 'action=post2';
}

echo '" + (current_board ? ";board=" + current_board : "") + (make_poll ? ";poll" : "") + ";preview;xml", x.join("&"), onDocSent);
               
document.getElementById("preview_section").style.display = "";
               
setInnerHTML(document.getElementById("preview_subject"), txt_preview_title);

setInnerHTML(document.getElementById("preview_body"), txt_preview_fetch);

return false;

Advertisement: