<?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 and multiselect</title>
		<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-and-multiselect</link>
		<description>Gravity Support Forums Topic: gform_pre_render and multiselect</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 15:15:35 +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-and-multiselect" rel="self" type="application/rss+xml" />

		<item>
			<title>Brian on "gform_pre_render and multiselect"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-and-multiselect#post-72349</link>
			<pubDate>Thu, 23 Aug 2012 16:13:51 +0000</pubDate>
			<dc:creator>Brian</dc:creator>
			<guid isPermaLink="false">72349@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Found another filter that works. &#34;gform_pre_submission_filter_1&#34;  You also have to modify the &#34;inputs&#34; array for it to work though.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_admin_pre_render&#38;quot;, &#38;quot;amenities&#38;quot;);
add_filter(&#38;quot;gform_pre_submission_filter_1&#38;quot;, &#38;quot;amenities&#38;quot;);
add_filter(&#38;#39;gform_pre_render_1&#38;#39;, &#38;#39;amenities&#38;#39;);
function amenities($form){

	$amenities = get_categories(array(&#38;#39;child_of&#38;#39; =&#38;gt; 15, &#38;#39;order_by&#38;#39; =&#38;gt; &#38;#39;name&#38;#39;, &#38;#39;hide_empty&#38;#39; =&#38;gt; 0));
	$amenities_choices = array();
	$amenities_inputs = array();
	$i = 1;
	foreach ($amenities as $amenity) {
		$amenities_choices[] = array(&#38;#39;text&#38;#39; =&#38;gt; $amenity-&#38;gt;name, &#38;#39;value&#38;#39; =&#38;gt; $amenity-&#38;gt;term_id);
		$amenities_inputs[] = array(&#38;#39;id&#38;#39; =&#38;gt; &#38;#39;12.&#38;#39;.$i, &#38;#39;label&#38;#39; =&#38;gt; $amenity-&#38;gt;name, &#38;#39;name&#38;#39; =&#38;gt; &#38;#39;&#38;#39;);
		$i++;
	}

	foreach($form[&#38;#39;fields&#38;#39;] as &#38;amp;$field) {
		if($field[&#38;#39;id&#38;#39;] == 12) {
			$field[&#38;#39;choices&#38;#39;] = $amenities_choices;
			$field[&#38;#39;inputs&#38;#39;] = $amenities_inputs;
		}
	}
	//ri_echo($form);
	return $form;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Brian on "gform_pre_render and multiselect"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-and-multiselect#post-72312</link>
			<pubDate>Thu, 23 Aug 2012 12:53:54 +0000</pubDate>
			<dc:creator>Brian</dc:creator>
			<guid isPermaLink="false">72312@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I am generating a multiselect field based on subcategories.&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;#39;gform_pre_render_1&#38;#39;, &#38;#39;amenities&#38;#39;);
function amenities($form){

	$amenities = get_categories(array(&#38;#39;child_of&#38;#39; =&#38;gt; 15, &#38;#39;order_by&#38;#39; =&#38;gt; &#38;#39;name&#38;#39;, &#38;#39;hide_empty&#38;#39; =&#38;gt; 0));
	$amenities_choices = array();
	foreach ($amenities as $amenity) {
		$amenities_choices[] = array(&#38;#39;text&#38;#39; =&#38;gt; $amenity-&#38;gt;name, &#38;#39;value&#38;#39; =&#38;gt; $amenity-&#38;gt;term_id);
	}

	foreach($form[&#38;#39;fields&#38;#39;] as &#38;amp;$field) {
		if($field[&#38;#39;id&#38;#39;] == 12) {
			$field[&#38;#39;choices&#38;#39;] = $amenities_choices;
		}
	}

	return $form;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;This works great. The problem is that on the creation of the form, I only have one &#34;item&#34; on the multiselect. So when processing Gforms only checks for one. I am looking for something that can be adjusted via a filter so it will process numbers based on the newly generated multiselect options.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
