<?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: Outputting conditional field within content template</title>
		<link>https://legacy.forums.gravityhelp.com/topic/outputting-conditional-field-within-content-template</link>
		<description>Gravity Support Forums Topic: Outputting conditional field within content template</description>
		<language>en-US</language>
		<pubDate>Mon, 13 Apr 2026 18:52:45 +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/outputting-conditional-field-within-content-template" rel="self" type="application/rss+xml" />

		<item>
			<title>Dana Cobb on "Outputting conditional field within content template"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/outputting-conditional-field-within-content-template#post-48042</link>
			<pubDate>Wed, 01 Feb 2012 17:45:06 +0000</pubDate>
			<dc:creator>Dana Cobb</dc:creator>
			<guid isPermaLink="false">48042@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi, Dave,&#60;/p&#62;
&#60;p&#62;I apologize for the delayed response to your post.&#60;/p&#62;
&#60;p&#62;Since you are using post content templates to format the display, you could create the post content template manually using the hook &#34;gform_pre_submission_filter&#34;. This way you can create the content template based on the radio button selection and only include the fields you need for the selection. Below is an example:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;//add filter to form id 23
add_filter(&#38;quot;gform_pre_submission_filter_23&#38;quot;, &#38;quot;pre_submission_filter&#38;quot;);
function pre_submission_filter($form)
{
	//check value of radio button and build content template
	if (rgpost(&#38;quot;input_8&#38;quot;) == &#38;quot;Agent&#38;quot;)
	{
		//put fields used for Agent into postContentTemplate, use &#38;quot;\n&#38;quot; for a carriage return
		//use merge tags, easiest to build the template in the admin and copy out what you need for the fields
		$form[&#38;quot;postContentTemplate&#38;quot;] = &#38;quot;Agent PRC License Number: {License Number Field 1:10}&#38;quot;;
	}
	else
	{
		//put fields used for Homeowner into postContentTemplate
		$form[&#38;quot;postContentTemplate&#38;quot;] = &#38;quot;This is my template when the user is a Homeowner: {License Number Field 1:10}&#38;quot;;
	}
	//return modified form object, the merge tags will be replaced after this
	return $form;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Take a look and let me know if you have questions.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Dave on "Outputting conditional field within content template"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/outputting-conditional-field-within-content-template#post-46558</link>
			<pubDate>Tue, 17 Jan 2012 08:13:54 +0000</pubDate>
			<dc:creator>Dave</dc:creator>
			<guid isPermaLink="false">46558@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hello, I have searched for a long time to find the answer to this. Essentially, I want to be able to output a conditional field into the content template. I know this is possible, but I need a prefix that will not show when the field is not used.&#60;/p&#62;
&#60;p&#62;let me explain the exact scenario.&#60;br /&#62;
It is a site for listing real estate properties and one field asks the user if they are the homeowner or an agent. If they are an agent, we need their licensing number, which is obtained in the following field. The licensing number needs to be displayed on the post, but I would like to format it so that it can look like this:&#60;br /&#62;
Agent PRC License Number: 123456789&#60;/p&#62;
&#60;p&#62;However, I can only seem to be able to output the field into the content template. I do not want to add &#34;Agent PRC License Number:&#34; in front of the field because if the user is a homeowner, then it would display &#34;Agent PRC License Number:&#34; with no license number.&#60;/p&#62;
&#60;p&#62;Is there a way to do this? Maybe I could add a prefix to the license number field so that it would output the prefix in front of the license number when it is called within the content template?&#60;/p&#62;
&#60;p&#62;Do you have any suggestions?&#60;/p&#62;
&#60;p&#62;Many thanks
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
