<?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: Checkboxes pre_render and populated dynamic</title>
		<link>https://legacy.forums.gravityhelp.com/topic/checkboxes-pre_render-and-populated-dynamic</link>
		<description>Gravity Support Forums Topic: Checkboxes pre_render and populated dynamic</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 08:27:11 +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/checkboxes-pre_render-and-populated-dynamic" rel="self" type="application/rss+xml" />

		<item>
			<title>giro on "Checkboxes pre_render and populated dynamic"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/checkboxes-pre_render-and-populated-dynamic#post-42855</link>
			<pubDate>Fri, 02 Dec 2011 06:46:43 +0000</pubDate>
			<dc:creator>giro</dc:creator>
			<guid isPermaLink="false">42855@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Alex, this work, but is not a solutio for me. I need to select checkbox from a dynamic value. I can know $field_values inside gform_pre_render hook?&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$field_values = array();
$field_values[&#38;#39;projProfe&#38;#39;] = &#38;quot;2,3&#38;quot;;
gravity_form(2, false, false, $display_inactive=false, $field_values, false);&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Alex Cancado on "Checkboxes pre_render and populated dynamic"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/checkboxes-pre_render-and-populated-dynamic#post-41282</link>
			<pubDate>Wed, 16 Nov 2011 13:59:15 +0000</pubDate>
			<dc:creator>Alex Cancado</dc:creator>
			<guid isPermaLink="false">41282@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I understand.&#60;br /&#62;
The easiest way to select them is to add the &#34;is_selected&#34; =&#38;gt; true property when creating the inputs.&#60;/p&#62;
&#60;p&#62;See below:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;$items[] = array(&#38;quot;value&#38;quot; =&#38;gt; $authorId, &#38;quot;isSelected&#38;quot;=&#38;gt;true, &#38;quot;text&#38;quot; =&#38;gt; &#38;quot;&#38;lt;img src=\&#38;quot;http://www.gravatar.com/avatar/&#38;quot;.md5($authorsInfo[$authorId]-&#38;gt;user_email).&#38;quot;?s=30\&#38;quot; class=\&#38;quot;img_avatar\&#38;quot;&#38;gt;&#38;quot;.$authorsInfo[$authorId]-&#38;gt;display_name);&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>giro on "Checkboxes pre_render and populated dynamic"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/checkboxes-pre_render-and-populated-dynamic#post-41248</link>
			<pubDate>Wed, 16 Nov 2011 04:15:18 +0000</pubDate>
			<dc:creator>giro</dc:creator>
			<guid isPermaLink="false">41248@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;My problem not is in email notification, entry list, entry detail, because in this case not use.&#60;/p&#62;
&#60;p&#62;I think that the problem is that an incompatible problem with populated dynamically and a checkbox that is filled dynamically.&#60;/p&#62;
&#60;p&#62;David.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Alex Cancado on "Checkboxes pre_render and populated dynamic"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/checkboxes-pre_render-and-populated-dynamic#post-41203</link>
			<pubDate>Tue, 15 Nov 2011 18:21:16 +0000</pubDate>
			<dc:creator>Alex Cancado</dc:creator>
			<guid isPermaLink="false">41203@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Dynamically creating a checkbox list is pretty complex. Being able to display it on the form is not a problem, but the admin side of things (email notification, entry list, entry detail, etc...) will not work correctly unless you write a lot of code to handle the data display in all different areas.&#60;br /&#62;
If you really want to tackle this, I can point you in the right direction, but it will take considerable amount of PHP code to get it done.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>giro on "Checkboxes pre_render and populated dynamic"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/checkboxes-pre_render-and-populated-dynamic#post-41108</link>
			<pubDate>Tue, 15 Nov 2011 04:54:38 +0000</pubDate>
			<dc:creator>giro</dc:creator>
			<guid isPermaLink="false">41108@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I have not problem creating a dynamic checkboxes with this code.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_pre_render&#38;quot;, &#38;quot;populate_dropdown_users&#38;quot;);

function populate_dropdown_users($form)
{
	// recollim usuaris registrats
	global $wpdb;
	$allAuthorIds = $wpdb-&#38;gt;get_col( &#38;quot;SELECT ID FROM {$wpdb-&#38;gt;users}&#38;quot; );
	$authorsInfo = array();
	$items = array();
	foreach( $allAuthorIds as $authorId ) {
  		$authorsInfo[$authorId] = get_userdata($authorId);
  		if($authorsInfo[$authorId]-&#38;gt;user_level==0)
  		{
  			$items[] = array(&#38;quot;value&#38;quot; =&#38;gt; $authorId, &#38;quot;text&#38;quot; =&#38;gt; &#38;quot;&#38;lt;img src=\&#38;quot;http://www.gravatar.com/avatar/&#38;quot;.md5($authorsInfo[$authorId]-&#38;gt;user_email).&#38;quot;?s=30\&#38;quot; class=\&#38;quot;img_avatar\&#38;quot;&#38;gt;&#38;quot;.$authorsInfo[$authorId]-&#38;gt;display_name);
  		}
	}

	foreach($form[&#38;#39;fields&#38;#39;] as &#38;amp;$field)
	{

		// buscarem els que tenen cssClass == custom_field_usuaris
	 	 if(strpos($field[&#38;#39;cssClass&#38;#39;],&#38;#39;custom_field_usuaris&#38;#39;)===false)
            continue;

          $field[&#38;quot;choices&#38;quot;] = $items;

	}

	 return $form; // retornem el formulari

}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;But when I tried to create a form with this checkboxes and populated dynamically a content, only first element is selected.&#60;/p&#62;
&#60;p&#62;Example.&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;$field_values = array();
$field_values[&#38;#39;projProfe&#38;#39;] = &#38;quot;2,3&#38;quot;;
gravity_form(2, false, false, $display_inactive=false, $field_values, false);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Only checkboxes with 2 value is checked not, checbox with value 3 is checked. If I do this with a checkbox with no pre_render content work correctly.&#60;/p&#62;
&#60;p&#62;Any idea?&#60;/p&#62;
&#60;p&#62;thanks.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
