I would like to add an external javascript source to my Gravity Form. Like this:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=true_or_false"></script>

How to do this? I don't get how can I do this with the function: wp_enqueue_script

Then after adding this external/remote JS source, I would like use a custom JS with http://www.gravityhelp.com/documentation/page/Gform_register_init_scripts such as this line:

var autocomplete = new google.maps.places.Autocomplete(inputAddress);

But this won't work unless I have the external JS source added...Any ideas?

1 Answer 1


I think you're looking for gform_enqueue_scripts which is simply a Gravity Forms specific version of the wp_enqueue_scripts hook. Either hook uses the wp_enqueue_script() function.

That function can take a local script—usually using get_template_directory_uri() (theme), get_stylesheet_directory_uri() child theme), or plugins_url() (plugin) to reference the file location—or an external location like what you're trying to do. You'd probably load both the external JS and your custom file on that same hook with two calls to wp_enqueue_script() with your custom file listing the external file as a dependency in the $deps arg.

What goes in that custom sheet is out of scope of this forum as it's plugin specific, but this should get you going.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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