<?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: automatically populate a dropdown with post titles?</title>
		<link>https://legacy.forums.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles</link>
		<description>Gravity Support Forums Topic: automatically populate a dropdown with post titles?</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 01:23:50 +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/automatically-populate-a-dropdown-with-post-titles" rel="self" type="application/rss+xml" />

		<item>
			<title>Carl Hancock on "automatically populate a dropdown with post titles?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles#post-14284</link>
			<pubDate>Mon, 13 Dec 2010 12:57:38 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">14284@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;@Carramba This is only possible using conditional logic.  Which means each variation would require you to add a drop down and manually add the values to the drop down and then use conditional logic to show/hide that drop down.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carramba on "automatically populate a dropdown with post titles?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles#post-14247</link>
			<pubDate>Sun, 12 Dec 2010 09:03:31 +0000</pubDate>
			<dc:creator>Carramba</dc:creator>
			<guid isPermaLink="false">14247@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;is it possible to make two &#60;u&#62;dynamically linked&#60;/u&#62; dropboxes?&#60;/p&#62;
&#60;p&#62;When I choose FORD, I see Explorer, Excursion in 2nd dropdown, OR&#60;br /&#62;
when I choose Chevrolet, I see corresponding chevy models...
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Alex Cancado on "automatically populate a dropdown with post titles?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles#post-12511</link>
			<pubDate>Thu, 11 Nov 2010 13:55:03 +0000</pubDate>
			<dc:creator>Alex Cancado</dc:creator>
			<guid isPermaLink="false">12511@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Can you send me a link to the page that has the link to the form?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mourgroup on "automatically populate a dropdown with post titles?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles#post-12502</link>
			<pubDate>Thu, 11 Nov 2010 13:40:19 +0000</pubDate>
			<dc:creator>mourgroup</dc:creator>
			<guid isPermaLink="false">12502@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi!&#60;/p&#62;
&#60;p&#62;I tried that but its not working when im using the code that Carl Hancock wrote on the top&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;//Adds a filter to form id 14. Replace 14 with your actual form id
add_filter(&#38;quot;gform_pre_render_14&#38;quot;, populate_dropdown);
function populate_dropdown($form){

    //Reading posts for &#38;quot;Business&#38;quot; category;
    $posts = get_posts(&#38;quot;category=Business&#38;quot;);

    //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;type&#38;quot;] = &#38;quot;select&#38;quot;;
            $field[&#38;quot;choices&#38;quot;] = $items;
        }

    return $form;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Alex Cancado on "automatically populate a dropdown with post titles?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles#post-12499</link>
			<pubDate>Thu, 11 Nov 2010 13:36:46 +0000</pubDate>
			<dc:creator>Alex Cancado</dc:creator>
			<guid isPermaLink="false">12499@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;What you can do is configure your drop down to &#34;Allow field to be populated dynamically&#34; and give it a parameter name (i.e. my_field).&#60;br /&#62;
You can then add &#34;?my_field=dropdown_value&#34; to the link that is targeting the page hosting your form.&#60;br /&#62;
If changing the link is not an option, you will have to use a hook.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mourgroup on "automatically populate a dropdown with post titles?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles#post-12473</link>
			<pubDate>Thu, 11 Nov 2010 07:26:54 +0000</pubDate>
			<dc:creator>mourgroup</dc:creator>
			<guid isPermaLink="false">12473@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi!&#60;/p&#62;
&#60;p&#62;Is it possible to pre select a value in the dropdown based on what page the user comes from?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JeanPaulH on "automatically populate a dropdown with post titles?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles#post-7798</link>
			<pubDate>Mon, 26 Jul 2010 09:11:10 +0000</pubDate>
			<dc:creator>JeanPaulH</dc:creator>
			<guid isPermaLink="false">7798@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;David, you're my hero! Your domain should be tonsoftalent.com instead of &#60;a href=&#34;http://www.ounceoftalent.com&#34; rel=&#34;nofollow&#34;&#62;ounceoftalent.com&#60;/a&#62; :D Can't thank you enough for your time and help.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "automatically populate a dropdown with post titles?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles#post-7796</link>
			<pubDate>Mon, 26 Jul 2010 07:57:27 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">7796@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Alright, fixed. Here is the update snippet: &#60;a href=&#34;http://pastie.org/1060312&#34; rel=&#34;nofollow&#34;&#62;http://pastie.org/1060312&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;The issue was a bad assumption on my part.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$form[&#38;#39;fields&#38;#39;][&#38;#39;0&#38;#39;][&#38;#39;content&#38;#39;] = $content;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;This line assumes that the index of the field in the form object is the same as the field id. This is not a good assumption to make; specifically in cases where forms have been updated several times. I've replaced that line with this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;for($i = 0; $i &#38;lt; count($form[&#38;#39;fields&#38;#39;]); $i++) {
    	if($form[&#38;#39;fields&#38;#39;][$i][&#38;#39;id&#38;#39;] == 42) {
    		$form[&#38;#39;fields&#38;#39;][$i][&#38;#39;content&#38;#39;] = $content;
    	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;What we are doing instead is looping through each field in the form object and checking if the field id of that field is the field id we are looking for (in this case &#34;42&#34;). If so, THEN we replace the old content with our updated content.&#60;/p&#62;
&#60;p&#62;I've implemented this on your server. Let me know if you run into any issues. :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JeanPaulH on "automatically populate a dropdown with post titles?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles#post-7784</link>
			<pubDate>Mon, 26 Jul 2010 00:11:20 +0000</pubDate>
			<dc:creator>JeanPaulH</dc:creator>
			<guid isPermaLink="false">7784@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Sent :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "automatically populate a dropdown with post titles?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles#post-7783</link>
			<pubDate>Sun, 25 Jul 2010 23:10:23 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">7783@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;If you don't mind, could I get FTP access to this WP install? I would probably have better luck troubleshooting this if I can see the backend. You can email me at &#60;a href=&#34;mailto:david@ounceoftalent.com&#34;&#62;david@ounceoftalent.com&#60;/a&#62;.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
