<?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: Dynamic Checkbox from Custom Taxonomy</title>
		<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkbox-from-custom-taxonomy</link>
		<description>Gravity Support Forums Topic: Dynamic Checkbox from Custom Taxonomy</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 08:27:14 +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/dynamic-checkbox-from-custom-taxonomy" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Dynamic Checkbox from Custom Taxonomy"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkbox-from-custom-taxonomy#post-83637</link>
			<pubDate>Thu, 25 Oct 2012 09:12:25 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">83637@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;@raffav, please being a new topic and ask your complete question there.  If it's related to the code posted by @squidgemann, you can find their contact details on their profile page:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.gravityhelp.com/forums/profile/squidgemann&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/forums/profile/squidgemann&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>raffav on "Dynamic Checkbox from Custom Taxonomy"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkbox-from-custom-taxonomy#post-83605</link>
			<pubDate>Thu, 25 Oct 2012 06:26:41 +0000</pubDate>
			<dc:creator>raffav</dc:creator>
			<guid isPermaLink="false">83605@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;how i can get checked [some, all] checkbox?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ptroxler on "Dynamic Checkbox from Custom Taxonomy"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkbox-from-custom-taxonomy#post-54629</link>
			<pubDate>Mon, 09 Apr 2012 12:04:15 +0000</pubDate>
			<dc:creator>ptroxler</dc:creator>
			<guid isPermaLink="false">54629@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Excellent instruction, solved my problem.&#60;/p&#62;
&#60;p&#62;NOTE when using 1.6.2&#60;br /&#62;
&#60;code&#62;$field_id = &#38;quot;2.&#38;quot;.$i;&#60;/code&#62;&#60;br /&#62;
should read&#60;br /&#62;
&#60;code&#62;$field_id = &#38;quot;2_&#38;quot;.$i;&#60;/code&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>brian.s on "Dynamic Checkbox from Custom Taxonomy"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkbox-from-custom-taxonomy#post-40560</link>
			<pubDate>Wed, 09 Nov 2011 03:31:11 +0000</pubDate>
			<dc:creator>brian.s</dc:creator>
			<guid isPermaLink="false">40560@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;This code populates the field dynamically, but entirely overwrites the Gravity Field definition in the Form Editor. Furthermore, the code fails the validation for &#34;required&#34; even though one or more boxes are checked.&#60;/p&#62;
&#60;p&#62;It would help if more thorough documentation was available for dynamically populating form fields using Gravity Forms intended methods, especially fields with multiple choices.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>fbrill on "Dynamic Checkbox from Custom Taxonomy"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkbox-from-custom-taxonomy#post-40256</link>
			<pubDate>Mon, 07 Nov 2011 11:25:45 +0000</pubDate>
			<dc:creator>fbrill</dc:creator>
			<guid isPermaLink="false">40256@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks man, Helps a lot!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Dynamic Checkbox from Custom Taxonomy"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkbox-from-custom-taxonomy#post-39488</link>
			<pubDate>Tue, 01 Nov 2011 00:24:52 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">39488@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thank you for posting your code.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>squidgemann on "Dynamic Checkbox from Custom Taxonomy"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkbox-from-custom-taxonomy#post-39405</link>
			<pubDate>Mon, 31 Oct 2011 12:07:30 +0000</pubDate>
			<dc:creator>squidgemann</dc:creator>
			<guid isPermaLink="false">39405@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;* Purely an informative post for the community, no need for an Admin response *&#60;/p&#62;
&#60;p&#62;I just spent a little while editing the code provided by the admin's on how to dynamically populate checkboxes so I could create a list of services from a custom taxonomy. It was pretty straight-forward but I just thought I'd post it incase it saves someone 20 minutes in the future.&#60;/p&#62;
&#60;p&#62;All the best,&#60;br /&#62;
Andy&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;//Adds a filter to form id 3, change number 3 to your form ID.
add_filter(&#38;quot;gform_pre_render_3&#38;quot;, populate_checkbox);
add_filter(&#38;quot;gform_admin_pre_render_3&#38;quot;, populate_checkbox);

function populate_checkbox($form){

	//Creating choices and inputs as empty arrays
    $choices = array();
    $inputs = array();

	$categories=  get_categories(&#38;#39;taxonomy=services&#38;#39;); // change services to the name of your taxonomy

	$i = 1; // we need a counter to create the field id

        // loop through the array and push the results to the $choices and $inputs arrays
	foreach ($categories as $category) {
                // field_id identify&#38;#39;s which element this is going to replace. Change 2 to whatever your field id should be
		$field_id = &#38;quot;2.&#38;quot;.$i;

		array_push($choices, array(&#38;quot;text&#38;quot; =&#38;gt; $category-&#38;gt;cat_name, &#38;quot;value&#38;quot; =&#38;gt; $category-&#38;gt;cat_name));
		array_push($inputs, array(&#38;quot;label&#38;quot; =&#38;gt; $category-&#38;gt;cat_name, &#38;quot;id&#38;quot; =&#38;gt; $field_id));

		$i++; // add 1 to the counter for the next loop
	}

    //Adding items to field id 2. Replace 2 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){
        //replace 2 with your checkbox field id
        if($field[&#38;quot;id&#38;quot;] == 2){
            $field[&#38;quot;choices&#38;quot;] = $choices;
            $field[&#38;quot;inputs&#38;quot;] = $inputs;
        }
    }

    return $form;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
