After loading the latest released and dev versions, autocomplete for US states is throwing an error (pop up js window)

I have location and gmap installed - both latest dev versions)

Picture attached showing error message.

Any help appreciated.

Comments

amccann’s picture

Title: Autocomplete errot » Autocomplete error
amccann’s picture

Status: Active » Closed (fixed)

This is a conflict with the devel module - turning off the module fixes the issue - has to be some js conflict.

doublejosh’s picture

Yup. Agreed.

gapple’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new461 bytes

As per the devel README.txt: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/devel/READM...
calling drupal_json() instead of drupal_to_js() modifies the Content-Type header to 'text/javascript' and devel no longer appends any data.

gapple’s picture

drumnjo’s picture

I've successfully applied the patch...

At first, instead of "An http error 0 occured" I got: "(no information available)" but now it's back to "An http error 0 occured"

Any ideas or other patches to apply?

Thanks,

Joe

patching file location.module
Hunk #1 succeeded at 933 (offset 8 lines).

gapple’s picture

@drumnjo
It looks like you have a separate issue. I can't really tell, but my guess is that you have a configuration problem or a conflicting module.

This patch will fix an issue of a GET request to a path such as /location/autocomplete/ca/British returning a javascript error since devel.modules appends html to the JSON response:
{ "British Columbia": "British Columbia" }<div class="dev-timer"> Page execution time was 33.82 ms. Executed 23 queries in 5.64 milliseconds.</div><div class="dev-memory-usage"><h3>Memory usage:</h3> Memory used at: devel_init()=<strong>0.58</strong> MB, devel_shutdown()=<strong>3.55</strong> MB.</div>

On your site, Firebug shows that an OPTIONS request is being performed, and no response is received. A direct request to the page returns a propers JSON response, however it has HTML opening and closing tags appended.
First, try disabling other modules to see if there is a conflict. If you're still having issues you should probably open a separate issue.

drumnjo’s picture

actually...what file is this command line located?:

input id="edit-province" class="form-text form-autocomplete location_auto_province location_auto_join_country" type="text" value="" name="province" maxlength="64" autocomplete="OFF"/

thanks,

joe

drumnjo’s picture

also is there an actual "autocomplete" directory as the error msg implies?

and why would mine be "options" and yours "get"?

'#multiple' => TRUE, //$this->options['multiple'], from location/handlers/location_handler_filter_location_province.inc

does this need to be changed to false?

can you send me a download link to a location module folder or patch that works?

drumnjo’s picture

Status: Needs review » Fixed

my problem turned out to be stats script pasted into index.php I moved it to page.tpl.php within theme works fine now

gapple’s picture

Title: Autocomplete error » Autocomplete error - conflict with Devel module
Status: Fixed » Needs review

Fixing status so that patch is still in queue, and updating title.

yesct’s picture

gapple, (or someone else) please write an updated summary about why this patch is needed, what it does, and a re-roll against the most recent dev version. Also comment on if these changes might cause problems in any other areas of location.

gapple’s picture

StatusFileSize
new482 bytes

I've attached the re-rolled patch.

Devel appends performance data to all page requests, unless they have their content-type specified as text/javascript. Since location uses `echo drupal_to_js()`, the header is not modified, and so devel appends html code on the end of the JSON data location is returning. This causes a parse error client side, since a valid JSON response is not received.

The `drupal_json()` function performs the same echo operation on the passed data, but also sets the content type header. This patch modifies location modules use of `drupal_to_js()` to `drupal_json()`.

This patch should not cause any conflicts with other areas of location.

yesct’s picture

wow. this is a 2 line change.
how do you recommend this get tested in order for someone to mark it RTBC?
would a person need to enable the devel module, and then do a performance test...? Please post a step by step of how to test this, that will really help us (uh, at least people like me!) have the confidence to attempt to review it.
Thanks.

bdragon’s picture

Status: Fixed » Closed (fixed)
Issue tags: -location conflicts with other modules

Automatically closed -- issue fixed for 2 weeks with no activity.