<?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 - are post variables available?</title>
		<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-are-post-variables-available</link>
		<description>Gravity Support Forums Topic: gform_pre_render - are post variables available?</description>
		<language>en-US</language>
		<pubDate>Tue, 21 Apr 2026 19:10:02 +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-are-post-variables-available" rel="self" type="application/rss+xml" />

		<item>
			<title>David Smith on "gform_pre_render - are post variables available?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-are-post-variables-available#post-46503</link>
			<pubDate>Mon, 16 Jan 2012 17:14:10 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">46503@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Great! Happy to hear you got this working.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dochara on "gform_pre_render - are post variables available?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-are-post-variables-available#post-46501</link>
			<pubDate>Mon, 16 Jan 2012 17:08:51 +0000</pubDate>
			<dc:creator>dochara</dc:creator>
			<guid isPermaLink="false">46501@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I got around it another way. I just made the field required, and the unset it if it was not needed. It was my bad function and not the absence of post data that was complicating things. :)&#60;/p&#62;
&#60;p&#62;In case it helps anyone else, this is what I was trying to do and what worked.&#60;/p&#62;
&#60;p&#62;Some products on this site require that the person purchasing declares that they have insurance. It should be clear what's happening here from that.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function sd_hide_or_require_insured($form){
	$insuredfield = array(&#38;#39;Insured&#38;#39;);
	global $post;
	$needsinsurance = get_post_meta($post-&#38;gt;ID,&#38;#39;_sd_prod_insurance&#38;#39;,true);
	if ($needsinsurance==0) {
		foreach($form[&#38;#39;fields&#38;#39;] as $key=&#38;gt;$field) {
			if(in_array($field[&#38;#39;label&#38;#39;], $insuredfield)) {
				unset($form[&#38;#39;fields&#38;#39;][$key]);
			}
		}
	}
    return $form;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>David Smith on "gform_pre_render - are post variables available?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-are-post-variables-available#post-46490</link>
			<pubDate>Mon, 16 Jan 2012 15:56:47 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">46490@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Assuming you are displaying your Gravity Form on a post/page, the &#60;strong&#62;$post&#60;/strong&#62; global should be available. Could you share the specific code you are using and perhaps a link to the page?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dochara on "gform_pre_render - are post variables available?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-are-post-variables-available#post-46474</link>
			<pubDate>Mon, 16 Jan 2012 11:58:29 +0000</pubDate>
			<dc:creator>dochara</dc:creator>
			<guid isPermaLink="false">46474@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I've searched for this, and made several attempts to resolve it without sucess.&#60;/p&#62;
&#60;p&#62;Essentially, I am using a single form and populating fields dynamically with post meta from the post where the form is embedded. That's working fine.&#60;/p&#62;
&#60;p&#62;However there is one field I want to appear ONLY when a certain post meta value is set.&#60;/p&#62;
&#60;p&#62;I tried to use gform_pre_render to achieve this, but I am realising that post parameters (I used $global posts; in my function) are unavailable. Is this the case? If so, is there any later point at which a field could be unset if it's not needed?&#60;/p&#62;
&#60;p&#62;Thank you.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
