I have tried using the latest stable release and couldn't get things working. There were js errors in the console and the maps are not loaded.

"Uncaught SyntaxError: Unexpected token ="  google_map_field_setter.js:107
"Uncaught ReferenceError: googleMapFieldPreviews is not defined" google_map_field_previews.js?nq1a60:16

I switched back to 7.x-2.13 and everything works fine.

PS: tested on vanilla drupal with jquery update - jquery 1.10

Comments

drupaledmonk’s picture

Issue summary: View changes
martinpesout’s picture

I have exactly the same problem. Any idea how to fix it?

drupaledmonk’s picture

Priority: Normal » Critical

For now roll back to 7.x-2.13 it works fine. I am taking the liberty to mark this as critical, since new users downloading this awesome module will not be able to get it work.

scot.hubbard’s picture

Assigned: Unassigned » scot.hubbard

I'm going to check this out on a fresh Drupal install, but on my dev version (which is fairly clean) I am not seeing these issues.

There were quite a few Javascript changes made in the 7.x-2.15 release, might be worth making sure your browser's cache is clean.

I'll let you know what I find.

Thanks.

martinpesout’s picture

Check also the case when you install previous stable version on your Drupal and after that you will do update to the latest stable version of this plugin.

scot.hubbard’s picture

Priority: Critical » Normal

Hi,

OK - I have tested on a clean install of Drupal (using google map field version 7.x-2.15) and I have also tested on a clean install of Drupal after upgrading from google map field 7.x-2.13 to 7.x-2.15.

The only issue I found is that you must set your admin theme to use jQuery 1.7 or above. If you are using "Seven" as your admin theme, the default jquery_update install leave it using jquery version bundled with the core which is 1.4.

After changing the admin theme to use jquery 1.7 I did not receive any errors. Because of this I have reduced the priority to normal.

It goes without saying that the site itself must use jquery 1.7 or above.

Please let me know how you get on.

Thanks,
Scot.

martinpesout’s picture

I confirm that after switching to jQuery 1.7 you won't get any error anymore. But after switching to jQuery 1.7 I had to update also jquery.form.js to latest version because I started to get another error during AJAX request on some forms in admin section.

Is it true that default jQuery for Admin section in Drupal 7 is jQuery 1.4.x? I'm worried whether low-experienced users can make this update without any additional instructions.

martinpesout’s picture

Sorry. I've mistaken. I still see this problem after switching to jQuery 1.7. No progress. Still the same bug as before. Can you tell me what kind of workaround are you using in admin section to update default jquery and other libraries (jquery.form.js and maybe other) to newer version? Thanks

scot.hubbard’s picture

Hi Martin,

I am not using any work-arounds.

The jQuery Update module gives you the option to set the version of jQuery for the site theme and the admin theme. If you leave with default settings then the admin theme is set to the Drupal core version of jQuery which is 1.4.

I have tested this on a clean install of Drupal with just the jquery_update and google_map_field modules installed and no other settings touched, and I cannot replicate what you are seeing.

Cheers,
Scot.

martinpesout’s picture

I've installed jquery_update but I still get this error. But I've found solution of this problem. In google_map_field_setter.js on the line 107 update:

  googleMapFieldPreviews = function(delta = -1) {

to this:

  googleMapFieldPreviews = function(delta) {
    if (delta == null) {
        delta = -1;
    }

After reload the problem is gone. But it's still important to have enabled jquery_update

scot.hubbard’s picture

Hi Martin,

I am glad that fixes the error for you, although it does look a bit of an odd method!

Also, while taking a break from writing this reply, I have realised that the issue you are seeing is browser specific! Are you using Chrome?

Change the following from...

googleMapFieldPreviews = function(delta = -1) {

  $('.google-map-field-preview').each(function() {

...to...

googleMapFieldPreviews = function(delta) {

  delta = typeof delta !== 'undefined' ? delta : -1;

  $('.google-map-field-preview').each(function() {

and it should fix it. I'll roll this into another release.

Thanks,
Scot.

martinpesout’s picture

Yeah. I'm using Chrome. And agree. Your suggestion of fix is better :)

scot.hubbard’s picture

Status: Active » Closed (fixed)

Fixed in release 7.x-2.16.