<?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: Gform_pre_render help</title>
		<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-help</link>
		<description>Gravity Support Forums Topic: Gform_pre_render help</description>
		<language>en-US</language>
		<pubDate>Tue, 21 Apr 2026 17:29:05 +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/gform_pre_render-help" rel="self" type="application/rss+xml" />

		<item>
			<title>gtm1ldy on "Gform_pre_render help"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-help#post-346326</link>
			<pubDate>Wed, 26 Jun 2013 17:03:00 +0000</pubDate>
			<dc:creator>gtm1ldy</dc:creator>
			<guid isPermaLink="false">346326@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Please close this topic.  I figured it out.  This is as simple as it gets and will help you do more advanced selections with GForms.  I've seen a few questions for this over the last 2 years with no responses.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gtm1ldy on "Gform_pre_render help"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-help#post-346304</link>
			<pubDate>Wed, 26 Jun 2013 16:38:07 +0000</pubDate>
			<dc:creator>gtm1ldy</dc:creator>
			<guid isPermaLink="false">346304@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;OK.  I have it narrowed down, I can manuall add choices but cannot retreive table data.  Here is where I am at.&#60;/p&#62;
&#60;p&#62;add_filter(&#34;gform_pre_render_5&#34;, populate_dropdown);&#60;br /&#62;
add_filter(&#34;gform_admin_pre_render_5&#34;, populate_dropdown);&#60;/p&#62;
&#60;p&#62;function populate_dropdown($form){&#60;br /&#62;
	global $wpdb;&#60;/p&#62;
&#60;p&#62;	$results = $wpdb-&#38;gt;get_row(&#34;SELECT btc_state_short from btc_state_list&#34;);&#60;br /&#62;
	$choices = array();&#60;br /&#62;
	$choices[] = array(&#34;text&#34; =&#38;gt; &#34;2323&#34;, &#34;value&#34; =&#38;gt; &#34;2323&#34;);&#60;/p&#62;
&#60;p&#62;// This is where I am stuck&#60;br /&#62;
	foreach ($results as $result) {&#60;br /&#62;
		$choices[] = array(&#34;value&#34; =&#38;gt; $result-&#38;gt;value, &#34;text&#34; =&#38;gt; $result-&#38;gt;value);&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;    foreach($form[&#34;fields&#34;] as &#38;amp;$field){&#60;/p&#62;
&#60;p&#62;        if($field[&#34;id&#34;] == 1){&#60;br /&#62;
            $field[&#34;choices&#34;] = $choices;&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    return $form;&#60;br /&#62;
}
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gtm1ldy on "Gform_pre_render help"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-help#post-346263</link>
			<pubDate>Wed, 26 Jun 2013 15:51:47 +0000</pubDate>
			<dc:creator>gtm1ldy</dc:creator>
			<guid isPermaLink="false">346263@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I cannot narrow this one down and am looking for your support.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Gform_pre_render help"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-help#post-346251</link>
			<pubDate>Wed, 26 Jun 2013 15:38:17 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">346251@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Can you isolate the issue by filling the items array manually with some values to test to see if that part of your code is working as expected?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gtm1ldy on "Gform_pre_render help"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-help#post-346244</link>
			<pubDate>Wed, 26 Jun 2013 15:31:56 +0000</pubDate>
			<dc:creator>gtm1ldy</dc:creator>
			<guid isPermaLink="false">346244@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;This documentation is for checkbox selections.  Below is my code, it will not return the States from the table.  Help would be greatly appreciated?&#60;/p&#62;
&#60;p&#62;add_filter(&#34;gform_pre_render_5&#34;, populate_dropdown);&#60;br /&#62;
add_filter(&#34;gform_admin_pre_render&#34;, populate_dropdown);&#60;/p&#62;
&#60;p&#62;function populate_dropdown($form){&#60;br /&#62;
	global $wpdb;&#60;/p&#62;
&#60;p&#62;	if($form[&#34;id&#34;] != 5)&#60;br /&#62;
		return $form;&#60;/p&#62;
&#60;p&#62;	$mytable = $wpdb-&#38;gt;btc_state_list;&#60;br /&#62;
	$q = &#34;SELECT btc_state_short from $mytable&#34;;&#60;br /&#62;
	$results = $wpdb-&#38;gt;get_results($q);&#60;/p&#62;
&#60;p&#62;	$items = array();&#60;br /&#62;
	$items[] = array(&#34;text&#34; =&#38;gt; &#34;&#34;, &#34;value&#34; =&#38;gt; &#34;&#34;);&#60;/p&#62;
&#60;p&#62;	foreach ($results as $result) {&#60;br /&#62;
		$items[] = array(&#34;value&#34; =&#38;gt; $results-&#38;gt;state, &#34;text&#34; =&#38;gt; $results-&#38;gt;state);&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;    foreach($form[&#34;fields&#34;] as &#38;amp;$field){&#60;br /&#62;
        if($form [&#34;id&#34;] == 1){&#60;br /&#62;
            $field[&#34;choices&#34;] = $items;&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    return $form;&#60;br /&#62;
}
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Gform_pre_render help"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-help#post-346214</link>
			<pubDate>Wed, 26 Jun 2013 14:39:23 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">346214@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Sorry, wrong documentation page. &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_field_choices&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_field_choices&#60;/a&#62; Is what you require.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gtm1ldy on "Gform_pre_render help"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-help#post-346184</link>
			<pubDate>Wed, 26 Jun 2013 14:21:29 +0000</pubDate>
			<dc:creator>gtm1ldy</dc:creator>
			<guid isPermaLink="false">346184@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi David,&#60;/p&#62;
&#60;p&#62;Thank you for the response. I am not trying to change the input type just populate the current type (dropdown) with data in a specific table column.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Gform_pre_render help"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-help#post-346081</link>
			<pubDate>Wed, 26 Jun 2013 13:17:27 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">346081@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I don't think anyone is going to give you the database query. But you could use &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_column_input&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_column_input&#60;/a&#62; to load the values into a  drop down field. The example code should get you very close to what you need.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gtm1ldy on "Gform_pre_render help"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-help#post-346036</link>
			<pubDate>Wed, 26 Jun 2013 12:53:58 +0000</pubDate>
			<dc:creator>gtm1ldy</dc:creator>
			<guid isPermaLink="false">346036@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Simply trying to populate a drop down from a custom table.&#60;/p&#62;
&#60;p&#62;Table Name:  abc-state-list&#60;br /&#62;
Column Name: state_short&#60;br /&#62;
Form 1&#60;br /&#62;
Field ID 1&#60;/p&#62;
&#60;p&#62;Can anyone help with the code to make this happen in functions.php?  The complete code?  &#60;/p&#62;
&#60;p&#62;Ive read so many submissions and on the web, all reference the help docs but they don't include any help on a sql queries as well.&#60;/p&#62;
&#60;p&#62;Thank you so much for helping out.  It shouldn't be difficult, new to wordpress not to the web.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
