> echo '<div id="showGoogleMap" onclick="showGoogleMap('.$all['id'].','.
> $all['BooksUser']['latitude'].',
> '.$all['BooksUser']['longitude'].','.$all['title'].')"
> style="float:right;cursor:pointer;">'.$html->image("icons/map.png",
> array("alt" => "Google Map anzeigen")).'</div>';
[snip]
> now when I hit
> the icon to open the map, firebug says this:
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> missing ) after argument list
> showGoogleMap(207,47.378824,8.548737,Tag Heuer Carrera Chronograph)
As you see from the error message (or by viewing source on the page), your PHP code generated the following HTML code:
<div id="showGoogleMap onclick="showGoogleMap(207,47.378824,8.548737,Tag Heuer Carrera Chronograph)" style="float:right;cursor:pointer;">...</div>
What got generated inside the onclick attribute is not valid JavaScript code, because the title string is not quoted or escaped properly. You probably want to use JsHelper::value($all['title']) instead of just echoing $all['title'] directly.
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment