Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: cal is null or not an object
PStoner_III
Junior Member

Posts: 2
Registered: 11/15/2004
Member Is Offline
posted on 11/15/2004 at 01:02 PM Reply With Quote
cal is null or not an object


Hi,
I have been through the forum and have tried all of the suggestions for trying to resolve this error, but with no luck.

I am trying to put this script into a PERL CGI script so I can use the calendar as a date picker.

Here is my Perl code thus far, this first line generates the HTML header and should include the calendar2.js file:

print $q->start_html(-title => "Haines Time and Status Tracking",
-background => "/image/lblue025.jpg",
-script=> "calendar2.js");

Then here is where I try to create the calendar object:

sub PrintSheet
{
my $SCRIPT=<<END;
<input type="Text" name="input5" value="">
<a href="javascript:cal5.popup();"><img src="/image/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a><br>
<script language="JavaScript">
<!-- // create calendar object(s) just after form tag closed
// specify form element as the only parameter (document.forms['formname'].elements['inputname']);
// note: you can have as many calendar objects as you need for your application
var cal5 = new calendar2(document.forms['tstest'].elements['input5']);
cal5.year_scroll = true;
cal5.time_comp = false;
</script>
END

print $SCRIPT;
}

Now when the CGI script is run, I can get to this OK and the text box and icon show up just fine. But when I click on the icon I get the cal5 is null or not an object error.

Here is the HTML output from the CGI script.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"><head><title>Haines Time and Status Tracking</title>
<script language="JavaScript" type="text/javascript">
<!-- Hide script
//<![CDATA[
calendar2.js
//]]> End script hiding --></script>

</head><body background="/image/lblue025.jpg"><basefont face="Arial, Verdana, Helvetica" />
<a href="index.cgi" status="Take me home"><img border="0" src="/image/Timesheet.gif" /></a>
<hr size="5" width="100%" />
<center>
<p>
<br><br><br>
</p>
<input type="Text" name="input5" value="">
<a href="javascript:cal5.popup();"><img src="/image/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a><br>
<script language="JavaScript">
<!-- // create calendar object(s) just after form tag closed
// specify form element as the only parameter (document.forms['formname'].elements['inputname']);
// note: you can have as many calendar objects as you need for your application
var cal5 = new calendar2(document.forms['tstest'].elements['input5']);
cal5.year_scroll = true;
cal5.time_comp = false;
</script>
<p>
<br><br><br>
</p>
</center>
<hr size="5" width="100%" />
</body></html>


Any and all help would be greatly appreciated.

Thanks

Paul
View User's Profile View All Posts By User U2U Member
PStoner_III
Junior Member

Posts: 2
Registered: 11/15/2004
Member Is Offline
posted on 11/15/2004 at 01:57 PM Reply With Quote
Never Mind Figured this part out


I have figured out how to get around this particular error.

First I had to imprt the entire calendar2.js file into my CGI script. I put it inside the function I will be using it in. Then I had to go through and remove all of the periods in the warning messages, because the Perl interpreter could not handle them properly. Finally, I had to escape the $ in the regex. Again, the perl interpreter saw this as a variable.

So this problem og cal5 being null or not an object is corrected.
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos
Free Download Free Download
Product Documentation Documentation
Support Forum Support Forum
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004