<?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 errors when simply trying to get form ID</title>
		<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-errors-when-simply-trying-to-get-form-id</link>
		<description>Gravity Support Forums Topic: gform_pre_render errors when simply trying to get form ID</description>
		<language>en-US</language>
		<pubDate>Fri, 01 May 2026 06:11:42 +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-errors-when-simply-trying-to-get-form-id" rel="self" type="application/rss+xml" />

		<item>
			<title>keeneyemedia on "gform_pre_render errors when simply trying to get form ID"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-errors-when-simply-trying-to-get-form-id#post-103993</link>
			<pubDate>Tue, 18 Dec 2012 10:33:40 +0000</pubDate>
			<dc:creator>keeneyemedia</dc:creator>
			<guid isPermaLink="false">103993@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I decided to not try and return the form ID as it appears you can't set a variable (global declaration does not work) outside an add_filter call in WP (not a G form thing).&#60;/p&#62;
&#60;p&#62;So - instead inside the &#34;gform_pre_render&#34; I'm getting the form ID and then via a case/switch I'm calling various &#34;gform_field_value_FIELDid&#34; and doing what I need to do - then the form renders with all the fields the way I want them...&#60;/p&#62;
&#60;p&#62;Work fine.&#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>keeneyemedia on "gform_pre_render errors when simply trying to get form ID"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-errors-when-simply-trying-to-get-form-id#post-103976</link>
			<pubDate>Tue, 18 Dec 2012 09:02:27 +0000</pubDate>
			<dc:creator>keeneyemedia</dc:creator>
			<guid isPermaLink="false">103976@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;This code (and a bunch more) lives in an include across a series of multiple pages.  Based on the page that loads there's a different form.  Since this is include code - I need to know WHICH form is on that page and then do certain things based on the form ID.&#60;br /&#62;
And here's the thing...  line 2 above WORKS - the displayed value is the form ID.&#60;br /&#62;
The PRESENCE of the add_filter (setting a variable or not) causes the errors&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_pre_render&#38;quot;, &#38;quot;update_the_fields&#38;quot;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;results in many:&#60;br /&#62;
Warning: Invalid argument supplied for foreach() in /home/thisguy/public_html/wp-content/plugins/gravityforms/form_display.php on line X or Y or Z&#60;/p&#62;
&#60;p&#62;Ultimately what I need to do is invoke a series of add_filter(&#34;gform_field_value_FIELDX&#34;, &#34;populate_FIELDX&#34;); for the unique fields on each unique form.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "gform_pre_render errors when simply trying to get form ID"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-errors-when-simply-trying-to-get-form-id#post-103760</link>
			<pubDate>Tue, 18 Dec 2012 00:03:03 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">103760@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I've never seen the WordPress function &#34;add_filter&#34; used like that.&#60;/p&#62;
&#60;p&#62;The gform_pre_render filter is designed to set the value of a field, not return a variable.  Can you explain how different forms may be loaded on the page but you do not know the form ID?  Maybe that will help me come up with a solution with you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>keeneyemedia on "gform_pre_render errors when simply trying to get form ID"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-errors-when-simply-trying-to-get-form-id#post-103640</link>
			<pubDate>Mon, 17 Dec 2012 18:06:45 +0000</pubDate>
			<dc:creator>keeneyemedia</dc:creator>
			<guid isPermaLink="false">103640@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;This should be simple...  I'm trying to grab the form ID on the current page using gform_pre_render and then based on the form ID within the function gform_pre_render is calling do some work...  (I don't always know which form is going to be loaded on the page) - so here's the simple version of the code:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;$i_this_form_id = add_filter(&#38;quot;gform_pre_render&#38;quot;, &#38;quot;update_the_fields&#38;quot;);
echo $i_this_form_id;

function update_the_fields ($form){
	return $form[&#38;quot;id&#38;quot;];
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;The thing is - no matter what I do or don't do with the gform_pre_render - it just puts a whole bunch of &#34; Invalid argument supplied for foreach()&#34; errors on my form. BUT the echo in there returns the correct form ID.&#60;br /&#62;
Is there a better way to make the determination of which form loaded on a page by ID so I can then run the correct gform_field_value_* operation on the form?  This seems to work but there's all those errors where the form goes - why?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
