SimplePortal
Support => English Support => Topic started by: hidden_ghost on March 05, 2010, 01:22:14 AM
-
hi I have a problem with shoutbox
when I post new shout nothing appear until I go to history
ever if I pressed refresh
it should be refreshing after 1 sec
no mods except sp
I tried GC , IE & FF
I tried more than one them and the default one also
for test
www.tu-eng.tk
test
123456
thx for ur help
-
yeah i know and this forum is totally boring have you ever found a boring forum than this..? >:-D and after i tell something extra they start saying stop spamming....... :ill: >:( >:( >:( >:(
-
One thing I noticed is that you are getting a recurring error on the page, in function onShoutReceived, which may be your problem:
Message: 'getElementsByTagName(...).0' is null or not an object
Line: 95
Char: 2
Code: 0
URI: http://tu-eng.tk/forum/Themes/default/scripts/portal.js (http://tu-eng.tk/forum/Themes/default/scripts/portal.js)
That is the very first line of the function.
Is anyone else running a shoutbox in a left-to-right forum?
-
do you mean right to left ?
if the recurring error how can i solve this prob
thx 4 ur help
-
yeah i know and this forum is totally boring have you ever found a boring forum than this..? >:-D and after i tell something extra they start saying stop spamming....... :ill: >:( >:( >:( >:(
hmmmmmmm
I really don't know weather u r joking :) :(
my native language isn't en
-
that bugs i experience too when i configure shout box for my joomla (http://source-be-with-you.blogspot.com) >:-D 8) ;D :ill: :vampire:
(http://baloing.blogspot.com)
-
I changed the language to English 'left to right' but the problem is still present
tu-eng.tk
username test
pass 123456
-
hEY SORRY GUYS I ACTUALLY ....NOTHIN
-
I changed the language to English 'left to right' but the problem is still present
tu-eng.tk
At least you know that is not the problem.
Summary of below:
onShoutReceived (in portal.js) is not checking
1) That its parameter is in fact an object of class XMLHttpRequest, rather than "False"
2) That, if it is an object of class XMLHttpRequest, it actually contains an element with TagName "smf", which contains an element with TagName "shout"
I suspect that AJAX is not working the way the SimplePortal shoutbox expects it to. Probably, when the XMLHttpRequest is sent, an error code is coming back.
But you are not seeing the error code, because none of the code is set up to display it. To create some debugging messages to tell you what the problem is, you would have to modify portal.js and script.js.
----------------------------------------------------------------------------
I am no expert on the shoutbox, but I started to look at the file that the error message is talking about.
The line it is complaining about is line 95, which is the first executable statement in function onShoutRecieved.
function onShoutReceived(XMLDoc)
{
var shouts = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("shout");
....
When I keep looking in the same file, I see that OnShoutReceived is called within sp_submit shout -- actually from sendXMLDocument
function sp_submit_shout(shoutbox_id, sSessionVar, sSessionId)
{
if (window.XMLHttpRequest)
{
shoutbox_indicator(shoutbox_id, true);
var shout_body = "";
if (portal_smf_version == 1.1)
shout_body = escape(textToEntities(document.getElementById('new_shout_' + shoutbox_id).value.replace(/&#/g, "&#"))).replace(/\+/g, "%2B");
else
shout_body = escape(document.getElementById('new_shout_' + shoutbox_id).value.replace(/&#/g, "&#").php_to8bit()).replace(/\+/g, "%2B");
sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + 'action=portal;sa=shoutbox;xml', 'shoutbox_id=' + shoutbox_id + '&shout=' + shout_body + '&' + sSessionVar + '=' + sSessionId, onShoutReceived);
In turn, sendXMLDocument is found in script.js
function sendXMLDocument(sUrl, sContent, funcCallback)
{
if (!window.XMLHttpRequest)
return false;
var oSendDoc = new window.XMLHttpRequest();
var oCaller = this;
if (typeof(funcCallback) != 'undefined')
{
oSendDoc.onreadystatechange = function () {
if (oSendDoc.readyState != 4)
return;
if (oSendDoc.responseXML != null && oSendDoc.status == 200)
funcCallback.call(oCaller, oSendDoc.responseXML);
else
funcCallback.call(oCaller, false);
};
}
oSendDoc.open('POST', sUrl, true);
if ('setRequestHeader' in oSendDoc)
oSendDoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
oSendDoc.send(sContent);
return true;
}
So sendXMLDocument creates a function that will call the function funcCallback when the ready state of the XML document it is creating changes.
If readyState is 4 (the request is complete), then the callback function is called.
If the status of the sent XML document is 200, then funcCallback is sent with an argument containing the responseXML of the sent document.
Otherwise, it is sent with an argument of FALSE.
It seems to me that onShoutReceived expects to receive an argument that is an object of type XMLDoc, and it expects that object to have an element with TagName "smf" (etc.).
The error message says that XMLDoc.getElementsByTagName("smf")[0] is null or not an object.
So onShoutReceived has received unexpected parameters.
I am thinking that, perhaps
funcCallback.call(oCaller, false);
Was executed. You could test for this, of course, by putting some degugging statements right up at the top of onShoutReceive, to check if XMLDoc == false
http://wiki.laptop.org/go/The_call_method_in_JavaScript (http://wiki.laptop.org/go/The_call_method_in_JavaScript)
http://www.w3schools.com/ajax/ajax_xmlhttprequest.asp (http://www.w3schools.com/ajax/ajax_xmlhttprequest.asp)
http://www.yaldex.com/wAjax/AcloserlookatHTTPstatuscodes.html (http://www.yaldex.com/wAjax/AcloserlookatHTTPstatuscodes.html)
-
hEY SORRY GUYS I ACTUALLY ....NOTHIN
hey Sophie
what's your problem :O
-
I changed the language to English 'left to right' but the problem is still present
tu-eng.tk
At least you know that is not the problem.
Summary of below:
onShoutReceived (in portal.js) is not checking
1) That its parameter is in fact an object of class XMLHttpRequest, rather than "False"
2) That, if it is an object of class XMLHttpRequest, it actually contains an element with TagName "smf", which contains an element with TagName "shout"
I suspect that AJAX is not working the way the SimplePortal shoutbox expects it to. Probably, when the XMLHttpRequest is sent, an error code is coming back.
But you are not seeing the error code, because none of the code is set up to display it. To create some debugging messages to tell you what the problem is, you would have to modify portal.js and script.js.
----------------------------------------------------------------------------
I am no expert on the shoutbox, but I started to look at the file that the error message is talking about.
The line it is complaining about is line 95, which is the first executable statement in function onShoutRecieved.
function onShoutReceived(XMLDoc)
{
var shouts = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("shout");
....
When I keep looking in the same file, I see that OnShoutReceived is called within sp_submit shout -- actually from sendXMLDocument
function sp_submit_shout(shoutbox_id, sSessionVar, sSessionId)
{
if (window.XMLHttpRequest)
{
shoutbox_indicator(shoutbox_id, true);
var shout_body = "";
if (portal_smf_version == 1.1)
shout_body = escape(textToEntities(document.getElementById('new_shout_' + shoutbox_id).value.replace(/&#/g, "&#"))).replace(/\+/g, "%2B");
else
shout_body = escape(document.getElementById('new_shout_' + shoutbox_id).value.replace(/&#/g, "&#").php_to8bit()).replace(/\+/g, "%2B");
sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + 'action=portal;sa=shoutbox;xml', 'shoutbox_id=' + shoutbox_id + '&shout=' + shout_body + '&' + sSessionVar + '=' + sSessionId, onShoutReceived);
In turn, sendXMLDocument is found in script.js
function sendXMLDocument(sUrl, sContent, funcCallback)
{
if (!window.XMLHttpRequest)
return false;
var oSendDoc = new window.XMLHttpRequest();
var oCaller = this;
if (typeof(funcCallback) != 'undefined')
{
oSendDoc.onreadystatechange = function () {
if (oSendDoc.readyState != 4)
return;
if (oSendDoc.responseXML != null && oSendDoc.status == 200)
funcCallback.call(oCaller, oSendDoc.responseXML);
else
funcCallback.call(oCaller, false);
};
}
oSendDoc.open('POST', sUrl, true);
if ('setRequestHeader' in oSendDoc)
oSendDoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
oSendDoc.send(sContent);
return true;
}
So sendXMLDocument creates a function that will call the function funcCallback when the ready state of the XML document it is creating changes.
If readyState is 4 (the request is complete), then the callback function is called.
If the status of the sent XML document is 200, then funcCallback is sent with an argument containing the responseXML of the sent document.
Otherwise, it is sent with an argument of FALSE.
It seems to me that onShoutReceived expects to receive an argument that is an object of type XMLDoc, and it expects that object to have an element with TagName "smf" (etc.).
The error message says that XMLDoc.getElementsByTagName("smf")[0] is null or not an object.
So onShoutReceived has received unexpected parameters.
I am thinking that, perhaps
funcCallback.call(oCaller, false);
Was executed. You could test for this, of course, by putting some degugging statements right up at the top of onShoutReceive, to check if XMLDoc == false
http://wiki.laptop.org/go/The_call_method_in_JavaScript (http://wiki.laptop.org/go/The_call_method_in_JavaScript)
http://www.w3schools.com/ajax/ajax_xmlhttprequest.asp (http://www.w3schools.com/ajax/ajax_xmlhttprequest.asp)
http://www.yaldex.com/wAjax/AcloserlookatHTTPstatuscodes.html (http://www.yaldex.com/wAjax/AcloserlookatHTTPstatuscodes.html)
thank you very very much for all of that
but now it seems that the problem is from the host I tried it on my localhost and everything was ok
then I deleted the forum and reinstalled it but the same problem
I want now to know what is the exact problem to tell them about to solve
another time thank you very much
-
If you are willing to make a small temporary change in script.js, you can find out what error message the host is sending. Then you can show the problem to your host.
When you are done with this testing, you can put the correct version of script.js back on.
Do you want to try this?
-
hidden_ghost, do you still require assistance with this?