Javascript Error Javascript Error
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Javascript Error

Started by LATH, February 17, 2005, 08:07:08 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LATH

I ran a search and found a thread like this started but there was no resolution...here is the other thread: http://forum.coppermine-gallery.net/index.php?topic=12561.0

Like the other thread I'm getting the following java script error when I attempt to change the description:

A Runtime Error has occurred.
Do you wish to Debug

Line: 258
Error: Object expected

When I drop into the debugger and inspect I see that textCounter is undefined according to the debugger.  The HTML includes a reference to scripts.js and the file does exist.  However, scripts.js doesn't include textCounter().  Instead textCounter is included in the body of the document as follows:

<script type="JavaScript">
function textCounter(field, maxlimit) {
       if (field.value.length > maxlimit) // if too long...trim it!
       field.value = field.value.substring(0, maxlimit);
}
</script>

The same error occurs on several themes including "classic".

Here is the url to the site: http://www.johnlathrop.com/gallery/

LATH

I think I found a solution...  :o

I copied the HTML into a test page at http://www.johnlathrop.com/gallery/test_bad.htm.  You can attempt to make a change to description ... any onkeydown should produce the error.

One little correction placed in http://www.johnlathrop.com/gallery/test_good.htm doesn't produce the error.

This is the corrected script in the HTML running on my client...I don't know how to affect the same fix in your dynamic code:

<script type="text/javascript">
function textCounter(field, maxlimit) {
       if (field.value.length > maxlimit) // if too long...trim it!
       field.value = field.value.substring(0, maxlimit);
}

donnoman

I'm pretty sure I don't recall seeing any code like that in the default themes that come with Coppermine.

What theme is it?

donnoman

Ahh, because its not part of the templates.

In stable it appears 3 times.

editOnePic.php around line 187
editpics.php around line 484
upload.php around line 306

in devel it appears 4 times
editOnePic.php
editpics.php
reviewcom.php
upload.php

It does appear that "text/javascript" is the correct W3C accepted content type, as it is used directly in an example on thier site.

There are probably more occurances than I found.

If another dev can confirm, I'll go through both stable and devel tomarrow to clean these up.


LATH

For what its worth I made the change to editOnePic.php, editpics.php and upload.php.  This solved my problem.   :)