Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Javascript Error  (Read 4333 times)

0 Members and 1 Guest are viewing this topic.

LATH

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Javascript Error
« on: February 17, 2005, 08:07:08 am »

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/
Logged

LATH

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Javascript Error
« Reply #1 on: February 17, 2005, 08:23:38 am »

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);
}
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Javascript Error
« Reply #2 on: February 17, 2005, 08:32:26 am »

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?
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Javascript Error
« Reply #3 on: February 17, 2005, 08:46:51 am »

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.

Logged

LATH

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Javascript Error
« Reply #4 on: February 18, 2005, 04:03:07 am »

For what its worth I made the change to editOnePic.php, editpics.php and upload.php.  This solved my problem.   :)
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 20 queries.