Hello,

I am trying to allow my users to preview a map with data on a form. I have given them a preview button which does an AHAH post and it renders the Javascript using the theme_gmap function. However when that content is returned and inserted into the page I get the "Javascript is required to view this map" message. I'm assuming this is b/c jQuery.extend that sets everything up does not get executed when the AHAH returns the content and inserts it into the DOM.

Any clues on what I could do? Or do I have to use a different approach, possibly having one map and just updating the markers? Is there an API for that?

Thanks for any help.

Comments

bdragon’s picture

Hmm, you might want to try calling _gmap_doheader() on the original page to make sure the prerequisites are loaded.

That said, I have not thoroughly tested gmap in an ahah situation. It most likely will have at least some trouble bootstrapping.

Bevan’s picture

Actually the main hassle is that inline <script> elements in AHAH are not parsed or executed by the javascript processor in Safari and IE7. We wrote some hacky code to work around this on the Hub Map tab of the Witness Hub's homepage, but ideally the js needs to be separated out into a separate asynchronous request and executed only once the asynchronous HTML has been loaded into the DOM.

Kristen Pol’s picture

I am having the same problem where the <script>*</script> gmap code is being filtered out when the field is updated with ahah. I need to get this fixed right now so will let you know once that happens.

Note that the <script>*</script> gmap code is in the json data that is returned. So, the problem is that it doesn't end up in the page. If I create the form so that the gmap code is put into a textarea, it works fine. It's when it's put into a form field with just "#value" that it doesn't put in the <script>*</script> gmap code.

Kristen

gagarine’s picture

thetoast’s picture

Was there a solutution for this? Anyone else tried to display a gmap from an ahah call?