javascript not working [message #923] |
Mon, 09 July 2007 13:13 ![Go to next message Go to next message](/theme/default/images/down.png) |
interop
Messages: 45 Registered: October 2006
|
Member |
|
|
When I try to use the Update(js) for x_person I get a "cal1 not defined" when I click on the 'select' for the start date. (this error is in the java console of my browser).
It works fine in the demo on the radicore website.
Here's the header from the html source on the radicore website
<head>
<title>Update Person (with javascript)</title>
<link rel="stylesheet" type="text/css" href="HTTP://www.radicore.org/demo/css/default.css"/>
<link rel="stylesheet" type="text/css" href="HTTP://www.radicore.org/demo/xample/style_custom.css"/>
<script language="javascript" src=" HTTP://www.radicore.org/demo/xample/javascript/usableforms.j s "/>
<script language="javascript">document.write();</script>
<script language="javascript">document.write(getCalendarStyles()); </script>
<script language="javascript" src=" HTTP://www.radicore.org/demo/xample/javascript/CalendarPopup .js "/>
<script language="javascript">document.write(getCalendarStyles()); </script>
<script language="javascript">var cal1 = new CalendarPopup(); cal1.showYearNavigation();</script>
</head>
And here's the header from my site.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Update Person (with javascript)</title>
<link rel="stylesheet" type="text/css" href="HTTP://<removed>/css/default-wide.css" />
<link rel="stylesheet" type="text/css" href="HTTP://<removed>/xample/style_custom.css" />
<script language="javascript" src="HTTP://<removed>/xample/javascript/usableforms.js"></script >
<script language="javascript"><![CDATA[document.write();]]></script >
<script language="javascript"><![CDATA[document.write(getCalendarStyles());]] ></script>
<script language="javascript" src="HTTP://<removed>/xample/javascript/CalendarPopup.js" ></script>
<script language="javascript"><![CDATA[document.write(getCalendarStyles());]] ></script>
<script language="javascript"><![CDATA[var cal1 = new CalendarPopup(); cal1.showYearNavigation();]]></script>
</head>
I'm using radicore 1.25, php5 and mysql5. This behavior is not new with radicore 1.25- maybe there's a php.ini setting I need?
[Updated on: Mon, 09 July 2007 13:13] Report message to a moderator
|
|
|
Re: javascript not working [message #924 is a reply to message #923] |
Mon, 09 July 2007 13:49 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
AJM
Messages: 2361 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
I have just tried it on my PC which runs PHP 5 and MySQL 5 without any problems.
Something on your PC is causing the javascript entries to be enclosed in '<![CDATA' and ']]>', which is why they are being ignored. The only places where createCDATASection() is used in my code is when adding the contents of header.txt or footer.txt.
You need to step through with your debugger to see what is causing this.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
|
Re: javascript not working [message #929 is a reply to message #926] |
Mon, 09 July 2007 17:35 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
AJM
Messages: 2361 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
The path through that code is governed by the value of the 'type' attribute in the XML file, which can either be 'file' or 'code'. This in turn is governed by the PHP code which was used to generate those XML entries. In this case the PHP code in question is found in file x_person_s02.class.inc in the _cm_setJavaScript() method, with the lines beginning
$javascript['head'][]['code'] = 'whatever';
or
$javascript['head'][]['file'] = 'whatever';
I have tried swapping the values 'code' and 'file', but I cannot reproduce the problem you describe.
This does not explain the fact that the original unaltered code works on both my home PCs and my website, but only misbehaves on your PC. This points to some sort of problem on your PC, but I am at a loss to explain what exactly.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
|
|
|
|