<?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: Populating a form Dynamically</title>
		<link>https://legacy.forums.gravityhelp.com/topic/populating-a-form-dynamically</link>
		<description>Gravity Support Forums Topic: Populating a form Dynamically</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 06:48: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/populating-a-form-dynamically" rel="self" type="application/rss+xml" />

		<item>
			<title>David Smith on "Populating a form Dynamically"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populating-a-form-dynamically#post-25248</link>
			<pubDate>Tue, 10 May 2011 18:07:14 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">25248@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Luke,&#60;/p&#62;
&#60;p&#62;Could you clarify why you need to add the filter in the loop as opposed to in the functions file?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>lukebream on "Populating a form Dynamically"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populating-a-form-dynamically#post-25237</link>
			<pubDate>Tue, 10 May 2011 16:42:48 +0000</pubDate>
			<dc:creator>lukebream</dc:creator>
			<guid isPermaLink="false">25237@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;yes correct
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Populating a form Dynamically"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populating-a-form-dynamically#post-25235</link>
			<pubDate>Tue, 10 May 2011 16:28:57 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">25235@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;So the problem is when you try to do this from the LOOP? If you try to do it on an individual page and place the code in your functions.php file it works?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>lukebream on "Populating a form Dynamically"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populating-a-form-dynamically#post-25234</link>
			<pubDate>Tue, 10 May 2011 16:28:15 +0000</pubDate>
			<dc:creator>lukebream</dc:creator>
			<guid isPermaLink="false">25234@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I have just been reading about add_filter and as I understand it I cannot use it on a page templat ...only inside the theme. funcions.php file. &#60;/p&#62;
&#60;p&#62;So hpw can I make this work from the page tem[plate ??
&#60;/p&#62;</description>
		</item>
		<item>
			<title>lukebream on "Populating a form Dynamically"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populating-a-form-dynamically#post-25232</link>
			<pubDate>Tue, 10 May 2011 16:21:46 +0000</pubDate>
			<dc:creator>lukebream</dc:creator>
			<guid isPermaLink="false">25232@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Carl&#60;/p&#62;
&#60;p&#62;Thanks for coming back to me. I already had the settings done to allow form to be populated dynamivaclly.&#60;/p&#62;
&#60;p&#62;I tested by putting my code into the theme functions file and it populates the form field correctly.&#60;/p&#62;
&#60;p&#62;I have changed the way the form is embeded so that it is embeded from my page template and this is also where my other code is. So I have the following code located on a page template inside the LOOP....which is still not working&#60;/p&#62;
&#60;p&#62;BTW....I checked and the  dynamic field name is correctly form_post_title&#60;/p&#62;
&#60;p&#62;So my code is:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php  $targetPost = $_GET[&#38;#39;postID&#38;#39;]; ?&#38;gt;

&#38;lt;?php echo $targetPost; ?&#38;gt;				

&#38;lt;?php $postTitle = $wpdb-&#38;gt;get_var($wpdb-&#38;gt;prepare(&#38;quot;SELECT post_title FROM $wpdb-&#38;gt;posts WHERE ID=$targetPost;&#38;quot;));
	echo &#38;#39;&#38;lt;p&#38;gt;Post Title is XXXXXX: &#38;#39; . $postTitle . &#38;#39;&#38;lt;/p&#38;gt;&#38;#39;;
?&#38;gt;

&#38;lt;?php gravity_form(3, false, false, false, &#38;#39;&#38;#39;, true); ?&#38;gt;

&#38;lt;?php add_filter(&#38;quot;gform_field_value_form_post_title&#38;quot;, &#38;quot;populate_form_post_title&#38;quot;);
	function populate_form_post_title($value){

	return &#38;quot;helo&#38;quot;;

	//return get_post_meta($post-&#38;gt;ID, &#38;#39;property_feed_id&#38;#39;, true);
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Populating a form Dynamically"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populating-a-form-dynamically#post-25228</link>
			<pubDate>Tue, 10 May 2011 16:00:30 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">25228@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Have you set the field you want to be populate so it can be populated dynamically? If so is &#34;form_post_title&#34; the parameter name you used to do so?&#60;/p&#62;
&#60;p&#62;- Edit the form&#60;br /&#62;
- Edit the field&#60;br /&#62;
- Select the advanced tab&#60;br /&#62;
- Check the &#34;allow field to be populated dynamically&#34; checkbox&#60;br /&#62;
- Give the field a parameter name, the parameter name is what is used with the gform_field_value hook.  In your care &#34;form_post_title&#34; would be the parameter name.&#60;/p&#62;
&#60;p&#62;You only provided part of the information.  If it's not populating it's because you either didn't set the field to be populated dynamically or you aren't properly implementing the code to populate the field.  The hook itself should work if used properly.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>lukebream on "Populating a form Dynamically"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populating-a-form-dynamically#post-25219</link>
			<pubDate>Tue, 10 May 2011 15:07:17 +0000</pubDate>
			<dc:creator>lukebream</dc:creator>
			<guid isPermaLink="false">25219@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi&#60;/p&#62;
&#60;p&#62;I have a form which i want to use to edit a post that a user has created.&#60;/p&#62;
&#60;p&#62;I have the follwoing code and I need to pre-populate the example field in the gravity form in this case with &#34;HELO&#34; but obviously will eventually be the variable generated by the query. Im inside the wp-loop BUT i'm quirying a different post ID from the one that the loop is displaying.&#60;/p&#62;
&#60;p&#62;The gravity form is embeded from the post-dashboard using the shortcode&#60;/p&#62;
&#60;p&#62;This code is not prepolulating the form...? Any thoughts would be really appreciated.&#60;/p&#62;
&#60;p&#62;Thanks&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php  $targetPost = $_GET[&#38;#39;postID&#38;#39;]; 

 $postTitle = $wpdb-&#38;gt;get_var($wpdb-&#38;gt;prepare(&#38;quot;SELECT post_title FROM $wpdb-&#38;gt;posts WHERE ID=$targetPost;&#38;quot;));

echo &#38;#39;&#38;lt;p&#38;gt;Post Title is: &#38;#39; . $postTitle . &#38;#39;&#38;lt;/p&#38;gt;&#38;#39;;

 add_filter(&#38;quot;gform_field_value_form_post_title&#38;quot;, &#38;quot;populate_form_post_title&#38;quot;);

function populate_form_post_title($value){

	return &#38;quot;HELLO&#38;quot;;

}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
