[Xsltforms-support] Google Maps in XForms
Brought to you by:
alain-couthures
From: Franclin F. <f.f...@4c...> - 2010-01-22 13:11:30
|
Hi All, Has someone ever managed to add a Google Map in an XForms web page? Here is what I did but it did not work and I still do not understand why. <?xml-stylesheet href="xsltforms.xsl" type="text/xsl"?> <?xsltforms-options debug="yes"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:sample="http://www.agencexml.com/sample" xmlns:ev="http://www.w3.org/2001/xml-events"> <head> <title>Hello World in XForms</title> <xf:model> <xf:instance> <data xmlns=""/> </xf:instance> </xf:model> <script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=MYKEY"></script> <script type="text/javascript"> function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(37.4419, -122.1419), 13); map.setUIToDefault(); } } </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> </body> </html> The page is saved as an XHTML file and when I tried to run it, the container is empty and when I look at the end console, I can see an error message saying that: * Error: uncaught exception: [Exception... "Operation is not supported" code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" location: "http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAVZubqDM1uNqBU_mrOtApzxT2yXp_ZAY8_ufC3CFXhHIE1NvwkxT6VPtEK1C-Bd6RZupKj3-67FexrQ Line: 1"]* *Error: GMap2 is not defined Source File: http://localhost:8080/xformjs/myform.xhtml Line: 3* Obviously when I removed all the XForms related content, the map appears normally. So what could be wrong here? Waiting for your reply. Franclin. |