AJAX Validation Woes? Here's the Solution (XHTML 1.0 Transitional)
If anyone else should happen to use the AJAX calendar in version 6 and have validation problems, the solution follows.
When you place the call to the calendar in the header, it loads a JavaScript snippet into your XHTML header. XHTML treats scripts as normal syntax, so the W3C validator will tell you you need to encode the carat symbols and ampersands in the JavaScript. This obviously isn't a solution, because then your JavaScript won't work!
So, the simple solution is to add CDATA comment tags so the browser knows to ignore everything between. If you're using the AJAX calendar, add the following tags (in red) around line 137 and 155 of calendar/calendar.php:
// AJAX JAVASCRIPT
if ($EPCAJAX==1) {
?>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
...javascript...
//--><!]]>
</script>
<?php
}
The bottom line: if the validator hassles you about bad syntax within a JavaScript snippet, just comment it out like that.
VosSavant
|