<?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: Allow HTML Block to be dynamically populated</title>
		<link>https://legacy.forums.gravityhelp.com/topic/allow-html-block-to-be-dynamically-populated</link>
		<description>Gravity Support Forums Topic: Allow HTML Block to be dynamically populated</description>
		<language>en-US</language>
		<pubDate>Sat, 04 Apr 2026 01:43:07 +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/allow-html-block-to-be-dynamically-populated" rel="self" type="application/rss+xml" />

		<item>
			<title>mrhoneyfoot on "Allow HTML Block to be dynamically populated"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-html-block-to-be-dynamically-populated#post-17432</link>
			<pubDate>Tue, 01 Feb 2011 14:36:35 +0000</pubDate>
			<dc:creator>mrhoneyfoot</dc:creator>
			<guid isPermaLink="false">17432@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;If I buy a developer license, is this kind of thing covered in the priority support?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Allow HTML Block to be dynamically populated"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-html-block-to-be-dynamically-populated#post-17431</link>
			<pubDate>Tue, 01 Feb 2011 14:19:51 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">17431@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi MrHoneyfoot,&#60;/p&#62;
&#60;p&#62;The level of customization you're attempting here is outside of the scope of standard support. We're happy to leave the topic open for fellow users to assist.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mrhoneyfoot on "Allow HTML Block to be dynamically populated"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-html-block-to-be-dynamically-populated#post-17409</link>
			<pubDate>Tue, 01 Feb 2011 12:44:59 +0000</pubDate>
			<dc:creator>mrhoneyfoot</dc:creator>
			<guid isPermaLink="false">17409@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Just got this snippet, does it contain the answer?&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;style = $(&#38;#39;#style&#38;#39;).val();
color = $(&#38;#39;#color&#38;#39;).val();

$.ajax({
     type: &#38;quot;POST&#38;quot;,
     url: &#38;quot;get_image.php&#38;quot;
     data: { &#38;quot;style&#38;quot; : style, &#38;quot;color&#38;quot; : color },
     success: function(msg) {
          $(&#38;quot;#image_field&#38;quot;).html(&#38;#39;&#38;lt;img src=&#38;quot;&#38;#39; + msg + &#38;#39;&#38;quot; /&#38;gt;&#38;#39;);
     }
});&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;and in get_image.php&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$color = $_POST[&#38;#39;color&#38;#39;];
$style = $_POST[&#38;#39;style&#38;#39;];
var $image;

// Logic goes here, setting $image to the appropriate image link

echo $image;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Anyone know how this fits into the snippet posted by Alex Cancado above?&#60;/p&#62;
&#60;p&#62;Thanks.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mrhoneyfoot on "Allow HTML Block to be dynamically populated"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-html-block-to-be-dynamically-populated#post-17379</link>
			<pubDate>Tue, 01 Feb 2011 04:12:24 +0000</pubDate>
			<dc:creator>mrhoneyfoot</dc:creator>
			<guid isPermaLink="false">17379@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Quick question for you Alex. I don't understand how your snippet can change the content dynamically. So how does it work?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mrhoneyfoot on "Allow HTML Block to be dynamically populated"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-html-block-to-be-dynamically-populated#post-17300</link>
			<pubDate>Mon, 31 Jan 2011 08:39:41 +0000</pubDate>
			<dc:creator>mrhoneyfoot</dc:creator>
			<guid isPermaLink="false">17300@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks to Alex Cancado for the snippet. As I understand it, the code isolates the specific form ID and then field ID. Anyone got any idea about the next step? How you set out the rules for dynamically changing the content based on other form field selections, in other words?&#60;/p&#62;
&#60;p&#62;Take the examples in the explanation above for colour and style. If there are 10 colours and 20 styles, that's 200 combinations that we want the HTML block to display. &#60;/p&#62;
&#60;p&#62;Anyone know what you should use to achieve this, and how?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Alex Cancado on "Allow HTML Block to be dynamically populated"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-html-block-to-be-dynamically-populated#post-17224</link>
			<pubDate>Sat, 29 Jan 2011 08:06:13 +0000</pubDate>
			<dc:creator>Alex Cancado</dc:creator>
			<guid isPermaLink="false">17224@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Yes, you can use the Pre-render hook to dynamically change the HTML block content.&#60;br /&#62;
Here is a code snippet to point you in the right direction. Place it in your theme's function.php file.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_pre_render&#38;quot;, &#38;quot;populate_dropdown&#38;quot;);

function populate_dropdown($form){

    //only applies to form id 124. Replace 124 with your actual form id
    if($form[&#38;quot;id&#38;quot;] != 124)
       return $form;

    //Modifying field id 1. Replace 1 with your actual field id. You can get the field id by looking at the input name in the markup.
    foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field)
        if($field[&#38;quot;id&#38;quot;] == 1){
            $field[&#38;quot;content&#38;quot;] = &#38;quot;My HTML block content&#38;quot;;
        }

    return $form;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>mrhoneyfoot on "Allow HTML Block to be dynamically populated"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/allow-html-block-to-be-dynamically-populated#post-17221</link>
			<pubDate>Sat, 29 Jan 2011 05:04:25 +0000</pubDate>
			<dc:creator>mrhoneyfoot</dc:creator>
			<guid isPermaLink="false">17221@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;My goal is to show a different image inside a html block based on cross-checking two multiple choice fields. Let's say they're called style and colour. Is it possible to dynamically populate a html block field to achieve this?&#60;/p&#62;
&#60;p&#62;My only other solution is to create a different html block with it's own image for every possible combination of style/colour (hundreds) and show/hide them where necessary using conditional logic. It will probably work but feels a bit clunky from a back-end point of view. Is there a smarter way?&#60;/p&#62;
&#60;p&#62;Out.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
