Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

RC2 -> RC3 Browser Error

Aloittaja memo, elokuu 22, 2006, 04:54:09 IP

« edellinen - seuraava »

memo

Hi everybody

I've just upgraded to RC3.
Now when i post something i get a Internet Explorer Error:

Line: 272
Char: 6
Error: 'document.forms.postmodify[...].name'is null or not an object
Code:0

Is this a bug?

J. Williams

Try reuploading the RC3 Default Theme, since the .js file may have gone corrupt :P
Joshua Jon Williams
Back in Action.

memo

I've tried this, but with no success. Is it a language Problem? I am using German...

zigzag

Hello,
I have the same problem (using the default theme) - I've tried re-uploading the default template and tried a clean install on a test site and still have the error:
http://www.simplemachines.org/community/index.php?topic=108028.msg694310#msg694310

kegobeer

Post a link to your forum.  Send me a PM with a test account so I can troubleshoot.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

zigzag

Hi,

I've pm'd the test account to you.

kegobeer

This is the offending javascript code that's in Post.template.php.  It is new to RC3.


// A function needed to discern HTML entities from non-western characters.
echo '
function saveEntities()
{
var textFields = ["subject", "message", "guestname", "evtitle", "question"];
for (i in textFields)
if (document.forms.postmodify.elements[textFields[i]])
document.forms.postmodify[textFields[i]].value = document.forms.postmodify[textFields[i]].value.replace(/&#/g, "&#");
for (i in document.forms.postmodify)
if (document.forms.postmodify[i].name.indexOf("options") == 0)
document.forms.postmodify[i].value = document.forms.postmodify[i].value.replace(/&#/g, "&#");
}';


This line that causes the error:


if (document.forms.postmodify[i].name.indexOf("options") == 0)


It causes errors in both IE and FF.  I'm no javascript expert, but it looks like you can't get any properties from .name.  Maybe dropping .name in favor of this:


if (document.forms.postmodify[i].indexOf("options") == 0)


But, like I said, I'm no javascript expert.  I'll point a dev to this thread.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

zigzag

Hi,
Thanks for looking at it, I tried changing that bit of code but still get the error.

Col

#8
I have a member who is reporting exactly the same problem. I tried the backup JS file, but it made no difference (he did empty his cache), so I can't see how it would be a problem with the script.js file.

Anyone with any ideas?

Member's setup: XP Pro, Internet Exlporer V6.0.2800.1106

Mine, almost identical: XP Pro, Internet Exlporer V6.0.2900.2180, but I receive no error.

I have yet get the member to try using FF.

kegobeer

Col, the error happens very quickly.  If you use FF, open the Javascript Console and visit one of the RC3 sites in question and try to post.  The error is logged in the console.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

zigzag

If your on a broadband connection you don't really notice it because it's only when you hit the 'post' button but if your on dial up and using IE it's really noticeable  :D
Doesn't happen here though.

memo

Lainaus käyttäjältä: zigzag - elokuu 24, 2006, 09:36:34 IP
If your on a broadband connection you don't really notice it because it's only when you hit the 'post' button but if your on dial up and using IE it's really noticeable  :D
Doesn't happen here though.

Yes that's correct. I think this is also the reason why my AJAX loading indicator isn't visible.
Is it perhaps a problem with the permissions of the AJAX-related files?

zigzag

I don't see an Ajax loading indicator either - am I supposed to, and where abouts?

Col

OK,

I saw the entry in FF JS consol. So what's the cause, and what's the solution?

Is this affecting everyone, or just a few of us?

Thanks.

kegobeer

Col, please read the thread for the full details.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

Col

Lainaus käyttäjältä: zigzag - elokuu 23, 2006, 05:19:40 IP
Hi,
Thanks for looking at it, I tried changing that bit of code but still get the error.

Hi Kegobeer,

I assumed that your solution was inaffective because of the above post, and because as you said, you are no JS expert (God-like campared to me though!) ;D

I'll try out your solution.

Thanks.

kegobeer

That's why I reported this in our bug system and asked a dev to take a look at this problem.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

Col

How about changing the code from == 0 to "is not null" instead?



kegobeer

The problem is that, as far as I can tell, you can't use .indexOf with .name, as .name doesn't have any objects associated with it.  Also, you can't use "is not null" with Javascript.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

kegobeer

This was fixed in the CVS.  Once I get the fix I'll post it here so you can fix your RC3 versions.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

Advertisement: