<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Run Javascript on Specific Field</title>
		<link>https://legacy.forums.gravityhelp.com/topic/run-javascript-on-specific-field</link>
		<description>Gravity Support Forums Topic: Run Javascript on Specific Field</description>
		<language>en-US</language>
		<pubDate>Tue, 21 Apr 2026 16:55:23 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/run-javascript-on-specific-field" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Run Javascript on Specific Field"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/run-javascript-on-specific-field#post-144989</link>
			<pubDate>Sat, 09 Feb 2013 01:21:27 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">144989@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;This is incorrect:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;#39;gform_enqueue_scripts_1_13&#38;#39;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;You can't use a field ID there.&#60;/p&#62;
&#60;p&#62;You can enqueue the script on the page or not.  The enqueue function does not target any fields.  Normally that is done when you call the script.  The script needs to be in the page, loaded with gform_enqueue_scripts_$form_id.  Then, there is normally another bit of JavaScript in the page, telling that script what fields it should be applied to.&#60;/p&#62;
&#60;p&#62;If you were to enqueue the script on the page, and nothing else, nothing at all will happen.  Now that you are including it in the page, so you can use the functions, the next step is to call those functions, normally in additional JavaScript.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poname on "Run Javascript on Specific Field"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/run-javascript-on-specific-field#post-144885</link>
			<pubDate>Fri, 08 Feb 2013 19:53:19 +0000</pubDate>
			<dc:creator>poname</dc:creator>
			<guid isPermaLink="false">144885@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Here is what I have come up with so far. Letme preface this with the fact caveat that I'm a complete newbie with php so, have at it!&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
function gf_suggest() {
wp-register_script(&#38;#39;gf-suggest&#38;#39;, get_stylesheet_directory(). &#38;#39;http://maps.googleapis.com/maps/api/jslibraries=places&#38;amp;sensor=true&#38;#39;);
add_action(&#38;#39;gform_enqueue_scripts_1_13&#38;#39;, &#38;#39;gf-suggest&#38;#39;, 10, 2);
	wp_enqueue_script(&#38;#39;gf-suggest&#38;#39;);
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>poname on "Run Javascript on Specific Field"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/run-javascript-on-specific-field#post-144806</link>
			<pubDate>Fri, 08 Feb 2013 16:14:53 +0000</pubDate>
			<dc:creator>poname</dc:creator>
			<guid isPermaLink="false">144806@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks Chris! Much appreciated. &#60;/p&#62;
&#60;p&#62;I still have a question that is perhaps the most important one in regards to adding auto suggest: how do I localize this script to a specific, custom field? Would I do some thing like this: gform_enqueue_script_1_10? 1 being the form number and 10 being the specific field? I only want auto suggest functionality for city/state. It would be weird if the auto suggest location script fired on all fields.&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
Dan
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Run Javascript on Specific Field"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/run-javascript-on-specific-field#post-144793</link>
			<pubDate>Fri, 08 Feb 2013 15:44:31 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">144793@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Yes, you can use gform_enqueue_scripts:&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_enqueue_scripts&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_enqueue_scripts&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;That will add the script to the page where the form is displayed.  The gform_enqueue_scripts filter to enqueue your script will go in your theme's functions.php file.&#60;/p&#62;
&#60;p&#62;I'm not sure about replacing wp_enqueue_script.  I think they work in tandem.  For example, your script may rely on jQuery, and that would be enqueued by WordPress if it's a dependency for your Places script.&#60;/p&#62;
&#60;p&#62;Try putting something online and let us know if you have any trouble.  Provide a link to the site where you implemented this and we'll take a look at it if you're having trouble.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poname on "Run Javascript on Specific Field"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/run-javascript-on-specific-field#post-144442</link>
			<pubDate>Thu, 07 Feb 2013 22:26:21 +0000</pubDate>
			<dc:creator>poname</dc:creator>
			<guid isPermaLink="false">144442@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I want to add auto suggest functionality to a custom post field titled &#34;city/state&#34;. I have a script from google places library. I was wondering what type of hook I would use (gform enqueue script?) and where I would put it (functions.php?). Does gform enqueue script replace wp enqueue script when running a script for gravity forms?&#60;/p&#62;
&#60;p&#62;I'm kind of a newbie at this stuff but pretty intuitive, so could someone be kind enough to point me in the right direction?&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
Dan
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
