Currently I am facing an issue involving making two plugins work well together. I am using a form plugin called formidable to create a new location custom post (custom post was made from a plugin called events manager).

The events manager plugin calculates the latitude and longitude and generates a Google map when the fields: location_Address,location_town,location_postcode,location_region,location_country ... are filled in.

The Question

Can anyone tell me how to make a script for the edit 'custom post' screen that moves the cursor to a specified field (after page load), automatically inserts a "space" to the field of choice, and then move the cursor to another field. So that the longitude,latitude and google map generates?

Question Back story (if needed)

The events manager plugin wasnt made to have those fields filled in from an external form source, but rather its own.

To make my self clearer after I create a location using the form from formidable and then go to the edit location screen, every thing looks fine. All fields are filled in (location town, postcode, custom fields etc). But after a second look at the location address details box I can see that the google map isn't loaded, it says "location not found" despite the fact that all the address fields are filled in.

http://awesomescreenshot.com/0761cjewe3 (image link)

I then found out that, when I add a 'space' (or any other character) to the any of the location fields, the google map loads.


  • any javascript errors?
    – birgire
    Commented Jun 2, 2013 at 14:31
  • @birgire hi, no javascript errors. In the first screen shot, i believe that the function that generates the lat,lon and map is activated when the details are added within the 'edit location ' screen. But because i use the form plugin to fill those fields in from the front end the function doesnt activate, unless i make a change to the input field in the edit screen. Hopefully that makes sense.
    – Adzay
    Commented Jun 2, 2013 at 14:54
  • what happens when you write em_maps() or google in the Chrome console window?
    – birgire
    Commented Jun 2, 2013 at 15:00
  • @birgire Hi , nothing. It doesn't find anything. I looked into this further and I think a workaround solution would be activating the function upon page load ( which I still do ot know how to do). Is that easier compared to my original request
    – Adzay
    Commented Jun 2, 2013 at 15:30
  • 1
    ok, I just picked up these two from this part of the javascript file. Sounds that your solution would be to pick up the 'change/keyup' event functions that update the map and load them in the footer on document ready.
    – birgire
    Commented Jun 2, 2013 at 15:44

1 Answer 1


Here is one idea:

You could try to fire the change event of the #location-address (for example) input text field when the page has loaded:

function custom_jquery() {
    echo "<script>jQuery(document).ready(function(){

        jQuery('#location-address').on( 'change', function( event ) { 
            console.log('debug: on change fired!');


add_action( 'admin_head-post.php', 'custom_jquery' );

if your editing page is post.php.

You could also target another input field. To see the debug info, you need to have the console window open (in the browser).

  • @birgie thanks, it doesnt work unfortunately. I decided to change it to work with .focus ( changed both event-manager.js and your function). but it highlights the whole text and doesn't activate the function.
    – Adzay
    Commented Jun 2, 2013 at 20:24
  • got it to work. I changed the change event functions to focusout and then with your example changed .change to .focus. So when the edit post page loads, the field is highlighted and then if i click anywhere else the map function runs.
    – Adzay
    Commented Jun 2, 2013 at 20:39
  • great to hear you worked it out, good luck with your project.
    – birgire
    Commented Jun 2, 2013 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.