<?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: dynamically populate field using variable</title>
		<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-field-using-variable</link>
		<description>Gravity Support Forums Topic: dynamically populate field using variable</description>
		<language>en-US</language>
		<pubDate>Tue, 21 Apr 2026 15:24:48 +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/dynamically-populate-field-using-variable" rel="self" type="application/rss+xml" />

		<item>
			<title>les112 on "dynamically populate field using variable"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-field-using-variable#post-21902</link>
			<pubDate>Mon, 28 Mar 2011 23:38:59 +0000</pubDate>
			<dc:creator>les112</dc:creator>
			<guid isPermaLink="false">21902@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks teabag for your reply. Sorry about the time delay but I am in Australia with different timezone.&#60;br /&#62;
I couldn't get your code to work..&#60;br /&#62;
The following worked. The closest I got to getting the page title, which I also want,  was the  page name using  get_query_var('category_name') &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_field_value_categoryid&#38;quot;, &#38;quot;populate_categoryid&#38;quot;);
function populate_categoryid($value){
return get_query_var(&#38;#39;cat&#38;#39;);
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>teabagstudios on "dynamically populate field using variable"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-field-using-variable#post-21734</link>
			<pubDate>Mon, 28 Mar 2011 08:09:47 +0000</pubDate>
			<dc:creator>teabagstudios</dc:creator>
			<guid isPermaLink="false">21734@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I used this, it's pretty much the same but you just use whatever WP function to pull out the value; in my case, a post title.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function populate_title(){
        $UTitle_value = get_the_title();
    return $UTitle_value;
    }
add_filter(&#38;quot;gform_field_value_UTitle&#38;quot;, &#38;quot;populate_title&#38;quot;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I guess you've done it already, but you'll need to create an input, set it so it can be populated dynamically, then give it the parameter name you specified in the function; in my case UTitle.&#60;/p&#62;
&#60;p&#62;Multiple categories, category child / parent etc. could cause you some problems.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>les112 on "dynamically populate field using variable"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-field-using-variable#post-21720</link>
			<pubDate>Sun, 27 Mar 2011 19:10:38 +0000</pubDate>
			<dc:creator>les112</dc:creator>
			<guid isPermaLink="false">21720@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I want to dynamically populate the category field using the parameter categoryid. In an earlier post by Kevin  there was the following code snippet&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
add_filter(&#38;quot;gform_field_value_categoryid&#38;quot;, &#38;quot;populate_categoryid&#38;quot;);
function populate_categoryid($value){
return  &#38;quot;55&#38;quot; ;
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;where &#34;55&#34; is the explicit value for the parameter categoryid. This works.&#60;br /&#62;
But I don't wan't to enter the explicit value by hand but rather use the variable $category_id, which has been calculated earlier in the theme function.&#60;br /&#62;
What modification to the above code snippet needs to be done to use the variable $category_id rather than the explicit value &#34;55&#34;.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
