cancel
Showing results for 
Search instead for 
Did you mean: 

CR Viewer - report shows but with Javascript error "theForm is undefined"

Former Member
0 Kudos

Hello,

I'm using the crystalreportviewer to display a report in our web application. On most environments we've been using (for development and testing) it's all working fine.

However, on my development machine and now on one of our testing environments, we get the javascript error once the report had loaded in the viewer. It renders the buttons (print, export, paging. etc) useless.

Has anyone seen this before and know how to fix it?

We're using Crystal Reports Server Embedded 2008, .net 3.5 and the crystalreportviewers12 virtual directory is a sub-directory of the website virtual directory.

The testing machine is a clean build of Windows 2003. I'm running Windows XP on my machine. Other machines with these configurations appear to be OK.

Any ideas?

Many thanks,

Nicola

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Some further information:

When I look at the source code for the page, I can see that the following code has been added by the viewer:


var theForm = document.forms['RunCrystalReport'];
if (!theForm) {
    theForm = document.RunCrystalReport;
}

// and a post back function which i don't seem to be able to post here!

However, somehow it doesn't find this. If i copy this into my aspx file (in the <head>) then the page renders correctly, with no error.

On most of out machines this isn't necessary. What could be the difference in the configurations? What do I need to do so I don't have to manually add this code?

Thanks,

Nicola

Former Member
0 Kudos

Hi, Nicola;

Try the resolution from this note:

[Undefined|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_dev/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233383331333133303331%7D.do]

Regards,

Jonathan

Former Member
0 Kudos

Hi Jonathan,

We already have that line in the web.config - the viewer draws correctly, but just with the javascript error.

Also the error in the symptons of the note is different from our error. We don't get the error on all environments, just some, but as far as I can tell, they are all configured the same. (apart from being different operating systems.

Thanks.

Nicola

Former Member
0 Kudos

Looks like I've been able to solve this problem.

It's because I had another javascript include file declared in the header (we use it to display messages if theres an error or some other problem displaying the report). If I remove it, then the report displays correctly and the javascript error does NOT occur.

Answers (0)