Open Shelob9 opened 10 years ago
Thanks for getting in touch so quickly Josh, and glad you like it. I'm happy to share considering it was pretty much the only code I had to write for a recent side job I picked up, since Pods basically enabled me to meet 90 percent of the clients requirements with just a few clicks.
Strange to hear the value isn't saving, I'm also using WP 3.9.1 and Pods 2.4.3 and I can't seem to reproduce that issue. Two things I'm curious about, 1- what is the value of the hidden input in the same div as the geocomplete input? (that is what actually gets persisted, the value is re-displayed in the editor by parsing that value and re-initializing the jQuery plugin) and 2- do you have an js errors in the console?
Thanks again for helping out.
On Fri, Jul 4, 2014 at 6:28 PM, Josh Pollock notifications@github.com wrote:
Brian-
I am the community manger for Pods and saw your submission of this plugin. I tried to reply by email, but the email you entered in the from bounced.
I wanted to say thank you for making this plugin, I think it's going to be a great plugin that a lot of Pods users could really benefit from.
When I tested it, using Pods 2.4.3 and WordPress 3.9.1 the gecoding works perfectly, but the value isn't saved. I'm not sure if that's something you're still working on or if I'm missing a step in setup. I'd be happy to help you get this plugin finished and answer any questions you have.
Take care, Josh Josh@Pods.io
Josh Pollock Pods Community Manager Pods.io
— Reply to this email directly or view it on GitHub https://github.com/beezee/pods-geocomplete-field/issues/1.
@beezee -
I'm happy to help out and would love to see this thing working and available for all to use.
I am testing with only Pods and your plugin active with the default theme.
After save the hidden field has no value set this is the HTML for it:
<input name="pods_meta_geocomplete" data-name-clean="pods-meta-geocomplete" data-label="geocomplete" id="pods-form-ui-pods-meta-geocomplete" class="pods-form-ui-field-type-text pods-form-ui-field-name-pods-meta-geocomplete" type="hidden" value="" tabindex="2" maxlength="255">
Here is the console error I am getting, both before and after saving:
JQMIGRATE: jQuery.parseJSON requires a valid JSON string
console.trace()
Uncaught TypeError: Cannot read property 'address' of null local.wordpress.dev/wp-content/plugins/pods-geocomplete-field-master/js/admin.js?ver=3.9.1:25
That's a good clue. Can you share the actual value you're puttting in the geocomplete? Sounds like it is coming back from Google with some values that make jQuery.parseJSON unhappy.
If I can reproduce I'll be able to determine what is causing that.
I've tried both full addresses, like "1600 Pennsylvania Avenue Northwest, Washington, DC, United States" as well as countries, like "Spain".
OK still can't reproduce in Chrome, Safari, or Firefox. What browser/version are you using?
I'm testing in latest Chrome and Firefox (main builds) in OSX 10.9.2
Here is my Pods Debug info:
Debug Information
WordPress Version: 3.9.1
PHP Version: 5.5.9-1ubuntu4
MySQL Version: 5.5.37
Server Software: nginx/1.6.0
Your User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
Session Save Path: /var/lib/php5
Session Save Path Exists: Yes
Session Save Path Writeable: Yes
Session Max Lifetime: 1440
WPDB Prefix: wp_
WP Multisite Mode: No
WP Memory Limit: 40M
Pods Network-Wide Activated: No
Pods Install Location: /srv/www/wordpress-default/wp-content/plugins/pods-test/
Pods Tableless Mode Activated: No
Pods Light Mode Activated: No
Currently Active Theme: Twenty Fourteen
Currently Active Plugins:
Pods - Custom Content Types and Fields: 2.4.3 Pods GeoComplete: 0.0.1
Also no console errors in post editor for CPT that does not have a Geocomplete field.
This is a tricky one. I spun up a brand new VM with nothing but Pods and Geocomplete and still can't reproduce. I'm using VagrantPress, the only differences in my Pods debug info are the Ubuntu version and web server (I'm using Apache.)
I'm curious what you're getting back from the geocoder, since you're seeing an error before save. Do you mind logging the result var to console on line 6 of js/admin.js? Also if you put in a breakpoint there and run the $.toJSON call that's inside the $input.val() call on line 7, what do you get back?
Sorry to ask but until I can reproduce I can't do much in terms of debugging.
I think I have an idea what is happening, I'll have an update to the plugin in a few min that will help with debugging (this is a case I should be handling, but since I could not produce it and still cannot I thought maybe it was not going to come up.)
OK Josh if you can update the plugin and tell me what you get in your console this time, I think we'll know exactly what's happening
Also CPT, tax, extend existing, or settings page?
The plugin neither works for me.
As said Josh, the point is that the hidden input is not filled by the geolocation input action.
For example:
<input name="pods_field_localization" data-name-clean="pods-field-localization" data-label="Lugar" id="pods-form-ui-pods-field-localization" class="pods-form-ui-field-type-text pods-form-ui-field-name-pods-field-localization" type="hidden" value tabindex="2" maxlength="255">
This input is not updated, the value is alway empty, if I modify the value manually (with dev tools on chrome), the information is saved (in the backend). But, when I load the pod in the backend, the map is empty but the hidden file has got the value modified by me.
I would to ask where is the point when the plugin writes the value to the hidden input.
Here's the line where it happens:
https://github.com/beezee/pods-geocomplete-field/blob/master/js/admin.js#L4
I have this running in production on client sites and have never been able to reproduce the issue, would love to know what it is if you can find the source of your problem, and happy to field a pull request.
Sorry, the code goes overthere. I say you what is hapenning in my machine.
I am debugging that function and $input has got this selector: pods-form-ui-field-name-address. But I haven't got any ocurrence like that in the html renderization.
The hidden input has got the class "pods-form-ui-field-name-pods-field-address" and not "pods-form-ui-field-name-address", I don't know if this is the key, where is set this mapping?
I send you a pull request with the solution, but I don't kwon why it works in your installations.
Your plugin is a life-saver, I did not give you thank you by the work, I am using it in a project.
Thanks @developez - looking at your PR I believe this may be a result of a pods or wp version change.
The js is keying off a class that pods puts in place, which in hindsight is a dumb idea. I'll have some time to look at it this weekend and get a fix in place that should be more resilient to behavior changes in wp or the pods framework.
Hi @beezee I had the same problem as the other guys. Made a comment on @developez PR with the replacement code I had. Does seem to be a version thing...
Brian-
I am the community manger for Pods and saw your submission of this plugin. I tried to reply by email, but the email you entered in the from bounced.
I wanted to say thank you for making this plugin, I think it's going to be a great plugin that a lot of Pods users could really benefit from.
When I tested it, using Pods 2.4.3 and WordPress 3.9.1 the gecoding works perfectly, but the value isn't saved. I'm not sure if that's something you're still working on or if I'm missing a step in setup. I'd be happy to help you get this plugin finished and answer any questions you have.
Take care, Josh
Josh@Pods.io
Josh Pollock Pods Community Manager Pods.io