I have included the map xbl component in my page and everything seems to be working fine except that the map is not displayed. Actually the code that is generated (from a view page source) is as follows:
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA29DoCyTBBHWCx75dFud5rxT4lftsSa3SaZIzQGxOmBuGKTUk8hQ4hiDXmoFdYblBeyWah68wn_JosQ" type="text/javascript"></script><script type="text/javascript"> xformsPageLoadedServer = function() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("xforms-element-4$map")); map.setCenter(new GLatLng(37.4419, -122.1419), 13); } }; </script> The problem that I can see is that the page does not include any element with id "xforms-element-4$map". When I display the page "xforms-sandbox/sample/xbl-map" from a recent war (nightly build), I do get to see a map but I am trying to display maps in my own webapp. Help appreciated, Laurent |
Administrator
|
Laurent,
I don't know how you can get an xformsPageLoadedServer defined this way. Do you have a recent nightly build? You should rather see something along these lines (here "unittest-map" is the ID on <fr:map>): function xformsPageLoadedServer() { ORBEON.xforms.Server.callUserScript("unittest_map_xf_6_xforms_function","unittest-map$map-container","unittest-map$map-container"); ORBEON.xforms.Server.callUserScript("unittest_map_xf_8_xforms_function","unittest-map$address","unittest-map$address"); ORBEON.xforms.Server.callUserScript("unittest_map_xf_6_xforms_function","unittest-map$address","unittest-map$map-container"); ORBEON.xforms.Server.callUserScript("unittest_map_xf_6_xforms_function","unittest-map$longitude","unittest-map$map-container"); ORBEON.xforms.Server.callUserScript("unittest_map_xf_6_xforms_function","unittest-map$latitude","unittest-map$map-container"); } If the map component works for you in the unittest-map.xhtml but doesn't work in your example, could you send us an example that shows the issue and runs in the XForms sandbox? Alex |
In reply to this post by Laurent Gauthier
Sorry, I had mixed up different builds. With the latest build, I do get the expected javascript code (and the map displays) when I run the map-unittest.xhtml in the sandbox. When I try to run this page in my own webapp, somehow, the <fr:*> tags are not intercepted by Orbeon and so I get the following content in my browser when I do a view source:
<fr:map address-ref="address" id="unittest-map" ....etc... I just can't figure out what triggers the handling of the xmlns:fr="http://orbeon.org/oxf/xml/form-runner tags since apparently, we do not explicitly "xi:include" custom-controls.xbl which used to contain the map.xbl component. There is some magic going on that I am missing.... <quote author="LGauthier"> I have included the map xbl component in my page and everything seems to be working fine except that the map is not displayed. Actually the code that is generated (from a view page source) is as follows: <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA29DoCyTBBHWCx75dFud5rxT4lftsSa3SaZIzQGxOmBuGKTUk8hQ4hiDXmoFdYblBeyWah68wn_JosQ" type="text/javascript"></script><script type="text/javascript"> xformsPageLoadedServer = function() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("xforms-element-4$map")); map.setCenter(new GLatLng(37.4419, -122.1419), 13); } }; </script> The problem that I can see is that the page does not include any element with id "xforms-element-4$map". When I display the page "xforms-sandbox/sample/xbl-map" from a recent war (nightly build), I do get to see a map but I am trying to display maps in my own webapp. Help appreciated, Laurent |
Administrator
|
Laurent,
<quote author="LGauthier"> Sorry, I had mixed up different builds. With the latest build, I do get the expected javascript code (and the map displays) when I run the map-unittest.xhtml in the sandbox. When I try to run this page in my own webapp, somehow, the <fr:*> tags are not intercepted by Orbeon and so I get the following content in my browser when I do a view source: <fr:map address-ref="address" id="unittest-map" ....etc... I just can't figure out what triggers the handling of the xmlns:fr="http://orbeon.org/oxf/xml/form-runner tags since apparently, we do not explicitly "xi:include" custom-controls.xbl which used to contain the map.xbl component. There is some magic going on that I am missing.... </quote> If you have a (very) recent build, this is done in config/xforms-widgets.xsl. And the property oxf.epilogue.xforms.widgets.auto-include-fr-widgets needs to be set to true (which it is by default). This file doesn't change very often but did recently (Thursday last week). Maybe that file didn't get updated when you updated your code? Alex |
Free forum by Nabble | Edit this page |