<?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: Pre Populate from CSV</title>
		<link>https://legacy.forums.gravityhelp.com/topic/pre-populate-from-csv</link>
		<description>Gravity Support Forums Topic: Pre Populate from CSV</description>
		<language>en-US</language>
		<pubDate>Sun, 19 Apr 2026 23:27:34 +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/pre-populate-from-csv" rel="self" type="application/rss+xml" />

		<item>
			<title>ktrusak on "Pre Populate from CSV"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pre-populate-from-csv#post-321301</link>
			<pubDate>Thu, 13 Jun 2013 17:29:22 +0000</pubDate>
			<dc:creator>ktrusak</dc:creator>
			<guid isPermaLink="false">321301@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Do you guys know how to prepopulate a dropdown from a csv file on the server?&#60;/p&#62;
&#60;p&#62;I would do it through the admin area, but the file is 30,000+ lines so that admin interface freezes when I try to save the form.&#60;/p&#62;
&#60;p&#62;This is what I attempted with, but no luck&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;#39;gform_pre_render_7&#38;#39;, &#38;#39;GF_prepopulate_2&#38;#39;);
function GF_prepopulate_2($form){
		 foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field){
            if($field[&#38;quot;id&#38;quot;] == 15){
					$csv = array();
					$file = fopen(&#38;#39;http://example.com/mf.csv&#38;#39;, &#38;#39;r&#38;#39;);

					while (($result = fgetcsv($file)) !== false)
					{
						$csv[] = $result;
					}
					fclose($file);

					foreach ($csv as $line){
								$field[&#38;#39;choices&#38;#39;][] = array( &#38;#39;text&#38;#39; =&#38;gt; $line, &#38;#39;value&#38;#39; =&#38;gt; $line);
							}
				}
			}
	 return $form;
	}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
