<?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 Checkboxes</title>
		<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkboxes</link>
		<description>Gravity Support Forums Topic: Dynamic Checkboxes</description>
		<language>en-US</language>
		<pubDate>Thu, 09 Apr 2026 02:39:23 +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-checkboxes" rel="self" type="application/rss+xml" />

		<item>
			<title>David Smith on "Dynamic Checkboxes"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkboxes#post-16668</link>
			<pubDate>Thu, 20 Jan 2011 06:32:29 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">16668@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi m4change,&#60;/p&#62;
&#60;p&#62;Just confirmed the lead dev. The &#60;strong&#62;gform_pre_render&#60;/strong&#62; hook is still your best bet for dynamically populating checkboxes. Not sure what is in store for checkbox population, but we will keep you posted via the blog of any upcoming features for this.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>m4change on "Dynamic Checkboxes"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkboxes#post-16619</link>
			<pubDate>Wed, 19 Jan 2011 17:22:47 +0000</pubDate>
			<dc:creator>m4change</dc:creator>
			<guid isPermaLink="false">16619@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Is there any more progress on this? I have a form that I'd like to populate radio buttons dynamically based on checkboxes from a previous step.  The smartest way I can think of so far is to use the javascript 'next page' hook to hide/show multiple choice options based on selected checkboxes from the previous step.  I was hoping for something more elegant.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dimensionmedia on "Dynamic Checkboxes"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkboxes#post-9738</link>
			<pubDate>Sun, 12 Sep 2010 12:25:25 +0000</pubDate>
			<dc:creator>dimensionmedia</dc:creator>
			<guid isPermaLink="false">9738@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Alex, Thanks. I'll give this a shot. I wanted to create checkboxes on the fly, and really didn't care about viewing or doing else via the admin. It would be great if we could open checkboxes up more in the future though.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Alex Cancado on "Dynamic Checkboxes"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkboxes#post-9476</link>
			<pubDate>Mon, 06 Sep 2010 16:58:14 +0000</pubDate>
			<dc:creator>Alex Cancado</dc:creator>
			<guid isPermaLink="false">9476@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;The checkbox field is surprisingly complex and we unfortunately don't have all the hooks in place to enable it to be populated dynamically without any limitations. The following code snippet is the best I could come up with. It will allow the checkboxes to be added to your form and you will be able to view the entry in the admin detail screen, but you won't be able to change the entry and update the checkbox values. You also won't be able to view the checkbox values in the entry list.&#60;br /&#62;
It is by no means a perfect solution, but like I said, it is the best we can do right now and it might be good enough for you.&#60;br /&#62;
I am going to keep this in mind and try to add the necessary hooks in the next versions so that checkboxes can be populated dynamically.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;//Adds a filter to form id 26. Replace 26 with your actual form id
add_filter(&#38;quot;gform_pre_render_26&#38;quot;, populate_checkbox);
add_filter(&#38;quot;gform_admin_pre_render_26&#38;quot;, populate_checkbox);

function populate_checkbox($form){

    //Creating choices
    $choices = array(
                    array(&#38;quot;text&#38;quot; =&#38;gt; &#38;quot;Test 1&#38;quot;, &#38;quot;value&#38;quot; =&#38;gt; &#38;quot;test1&#38;quot;),
                    array(&#38;quot;text&#38;quot; =&#38;gt; &#38;quot;Test 2&#38;quot;, &#38;quot;value&#38;quot; =&#38;gt; &#38;quot;test2&#38;quot;),
                    array(&#38;quot;text&#38;quot; =&#38;gt; &#38;quot;Test 3&#38;quot;, &#38;quot;value&#38;quot; =&#38;gt; &#38;quot;test3&#38;quot;)
                    );

    $inputs = array(
                    array(&#38;quot;label&#38;quot; =&#38;gt; &#38;quot;Test 1&#38;quot;, &#38;quot;id&#38;quot; =&#38;gt; 2.1), //replace 2 in 2.1 with your field id
                    array(&#38;quot;label&#38;quot; =&#38;gt; &#38;quot;Test 2&#38;quot;, &#38;quot;id&#38;quot; =&#38;gt; 2.2), //replace 2 in 2.2 with your field id
                    array(&#38;quot;label&#38;quot; =&#38;gt; &#38;quot;Test 2&#38;quot;, &#38;quot;id&#38;quot; =&#38;gt; 2.3), //replace 2 in 2.3 with your field id
                );

    //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>
		<item>
			<title>dimensionmedia on "Dynamic Checkboxes"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkboxes#post-9402</link>
			<pubDate>Sat, 04 Sep 2010 22:04:40 +0000</pubDate>
			<dc:creator>dimensionmedia</dc:creator>
			<guid isPermaLink="false">9402@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Very simply, i'm attempting to use filters/hooks to populate the values and names of a set of checkboxes on a form on my site (which is embedded via the php gravity_form() function).&#60;/p&#62;
&#60;p&#62;I've searched through the forum and I've seen examples for dropdowns and text boxes, but nothing on checkboxes. If i've missed something specific, please point me in the first direction.&#60;/p&#62;
&#60;p&#62;This is what I have so far, but of course this is totally wrong. And yes, I did check off the dynamic option for my checkboxes and assigned 'photos' as the param.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_field_value_photos&#38;quot;, &#38;quot;populate_photos&#38;quot;);
function populate_photos(){
$items[] = array(&#38;quot;value&#38;quot; =&#38;gt; &#38;#39;test&#38;#39;, &#38;quot;text&#38;quot; =&#38;gt; &#38;#39;test1&#38;#39;);
return $items;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Thanks in advance!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
