<?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: Allow fields to be dynamically populated - Agentpress 2.0</title>
		<link>https://legacy.forums.gravityhelp.com/topic/allow-fields-to-be-dynamically-populated-agentpress-20</link>
		<description>Gravity Support Forums Topic: Allow fields to be dynamically populated - Agentpress 2.0</description>
		<language>en-US</language>
		<pubDate>Sun, 19 Apr 2026 20:12: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/allow-fields-to-be-dynamically-populated-agentpress-20" rel="self" type="application/rss+xml" />

		<item>
			<title>lyakov on "Allow fields to be dynamically populated - Agentpress 2.0"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-fields-to-be-dynamically-populated-agentpress-20#post-96433</link>
			<pubDate>Wed, 28 Nov 2012 04:09:27 +0000</pubDate>
			<dc:creator>lyakov</dc:creator>
			<guid isPermaLink="false">96433@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi, did you change field id to match your ?&#60;/p&#62;
&#60;p&#62;if($field[&#34;id&#34;] == 8)  &#60;/p&#62;
&#60;p&#62;cause in my form I have field id =4, I just copied code from that thread and everything works
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ddg on "Allow fields to be dynamically populated - Agentpress 2.0"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-fields-to-be-dynamically-populated-agentpress-20#post-94154</link>
			<pubDate>Wed, 21 Nov 2012 17:13:28 +0000</pubDate>
			<dc:creator>ddg</dc:creator>
			<guid isPermaLink="false">94154@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_pre_render&#38;quot;, &#38;quot;populate_dropdown&#38;quot;);

//Note: when changing drop down values, we also need to use the gform_admin_pre_render so that the right values are displayed when editing the entry.
add_filter(&#38;quot;gform_admin_pre_render&#38;quot;, &#38;quot;populate_dropdown&#38;quot;);

function populate_dropdown($form){

    //only populating drop down for form id 5
    if($form[&#38;quot;id&#38;quot;] != 2)
       return $form;

    //Reading posts for &#38;quot;Business&#38;quot; category;
    $posts = get_posts( array( &#38;#39;post_type&#38;#39;  =&#38;gt; &#38;#39;listing&#38;#39; ) );

    //Creating drop down item array.
    $items = array();

    //Adding initial blank value.
    $items[] = array(&#38;quot;text&#38;quot; =&#38;gt; &#38;quot;&#38;quot;, &#38;quot;value&#38;quot; =&#38;gt; &#38;quot;&#38;quot;);

    //Adding post titles to the items array
    foreach($posts as $post)
        $items[] = array(&#38;quot;value&#38;quot; =&#38;gt; $post-&#38;gt;post_title, &#38;quot;text&#38;quot; =&#38;gt; $post-&#38;gt;post_title);

    //Adding items to field id 8. Replace 8 with your actual field id. You can get the field id by looking at the input name in the markup.
    foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field)
        if($field[&#38;quot;id&#38;quot;] == 8){
            $field[&#38;quot;choices&#38;quot;] = $items;
        }

    return $form;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;- I have it placed at the bottom of functions.php&#60;/p&#62;
&#60;p&#62;- Form's id is 2
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Allow fields to be dynamically populated - Agentpress 2.0"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-fields-to-be-dynamically-populated-agentpress-20#post-94063</link>
			<pubDate>Wed, 21 Nov 2012 11:35:37 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">94063@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I don't think we have enough information to help you.   Can you please paste all the code you are using to populate your drop down, at pastebin.com or pastie.org, so we can see about debugging it?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ddg on "Allow fields to be dynamically populated - Agentpress 2.0"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-fields-to-be-dynamically-populated-agentpress-20#post-93674</link>
			<pubDate>Tue, 20 Nov 2012 19:20:48 +0000</pubDate>
			<dc:creator>ddg</dc:creator>
			<guid isPermaLink="false">93674@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;OK I am much closer but still not successful...&#60;/p&#62;
&#60;p&#62;- I am filtering all other forms&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;if($form[&#38;quot;id&#38;quot;] != 2)
       return $form;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;- I have specified the post type as listing:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;$posts = get_posts( array( &#38;#39;post_type&#38;#39;  =&#38;gt; &#38;#39;listing&#38;#39; ) );&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;- The code is placed in the function.php file at the root of the theme&#60;/p&#62;
&#60;p&#62;- A form with an id of 2 is placed in the listing and has 3 dummy options.&#60;br /&#62;
Does the form need to be empty?&#60;/p&#62;
&#60;p&#62;Not sure why this isn't working?&#60;br /&#62;
Any help?&#60;br /&#62;
Thanks
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Allow fields to be dynamically populated - Agentpress 2.0"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-fields-to-be-dynamically-populated-agentpress-20#post-93252</link>
			<pubDate>Mon, 19 Nov 2012 22:59:19 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">93252@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Instead of posts in a specific category, you would use posts of a certain post type, without the category.  In the first example on the gform_pre_render page, for line 14:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
$posts = get_posts(&#38;quot;category=&#38;quot; . get_cat_ID(&#38;quot;Business&#38;quot;));&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;You would use this instead&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;[php]
$posts = get_posts( array( &#38;#39;post_type&#38;#39;  =&#38;gt; &#38;#39;houses&#38;#39; ) );&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;(Replace 'houses' with whatever the actual name of the custom post type is.  If you used 'post' there, you would get posts from all categories.)&#60;/p&#62;
&#60;p&#62;Full documentation for the WordPress function get_posts can be found here:&#60;br /&#62;
&#60;a href=&#34;http://codex.wordpress.org/Function_Reference/get_posts&#34; rel=&#34;nofollow&#34;&#62;http://codex.wordpress.org/Function_Reference/get_posts&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ddg on "Allow fields to be dynamically populated - Agentpress 2.0"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-fields-to-be-dynamically-populated-agentpress-20#post-93179</link>
			<pubDate>Mon, 19 Nov 2012 20:07:55 +0000</pubDate>
			<dc:creator>ddg</dc:creator>
			<guid isPermaLink="false">93179@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks Chris. This is helpful. I see in the first example that populates a drop down they use the business category. I am not sure if you or anyone else is familiar with agentpress 2.0 but it is a real estate template that has (i am guessing) a custom data type called listings that doesn't fall into any categories... I am not able to assign a category to listings. Any idea how I would specify that I want to list the listings rather than a category..? Any documentation in the right direction or schooling you may want to bless me with is greatly appreciated. I am not familiar with these hooks and how to utilize them.&#60;br /&#62;
Thanks
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Allow fields to be dynamically populated - Agentpress 2.0"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-fields-to-be-dynamically-populated-agentpress-20#post-93013</link>
			<pubDate>Mon, 19 Nov 2012 11:26:29 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">93013@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Out of the box, there is no way to have all of the WordPress post titles to pre-populate a drop down selection in one of our forms. Though, with some custom PHP, this can be accomplished.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Allow fields to be dynamically populated - Agentpress 2.0"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-fields-to-be-dynamically-populated-agentpress-20#post-93012</link>
			<pubDate>Mon, 19 Nov 2012 11:26:19 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">93012@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;To populate any form field dynamically, you can use the gform_pre_render hook:&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_pre_render&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_pre_render&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;There are examples on that page of populating a drop down custom posts, which is what I think you want to do?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ddg on "Allow fields to be dynamically populated - Agentpress 2.0"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-fields-to-be-dynamically-populated-agentpress-20#post-93009</link>
			<pubDate>Mon, 19 Nov 2012 11:21:00 +0000</pubDate>
			<dc:creator>ddg</dc:creator>
			<guid isPermaLink="false">93009@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I am working with G Forms in conjunction with agentpress 2.0. I notice that in the demo there is a form that asks the user which property they are inquiring about. Can I populate that list dynamically with all the listings in the site so not have my client manually populate it? This is the reason I bought G Forms... Otherwise I could have done the forms with a free module. Hope this is possible.&#60;/p&#62;
&#60;p&#62;Can this be done?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
