<?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 population oddity</title>
		<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkbox-population-oddity</link>
		<description>Gravity Support Forums Topic: Dynamic checkbox population oddity</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 08:28:32 +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-population-oddity" rel="self" type="application/rss+xml" />

		<item>
			<title>Dana Cobb on "Dynamic checkbox population oddity"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkbox-population-oddity#post-48303</link>
			<pubDate>Fri, 03 Feb 2012 17:16:14 +0000</pubDate>
			<dc:creator>Dana Cobb</dc:creator>
			<guid isPermaLink="false">48303@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi, sjolshagen,&#60;/p&#62;
&#60;p&#62;I am closing this topic since we are working with you in a Priority Support ticket.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sjolshagen on "Dynamic checkbox population oddity"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamic-checkbox-population-oddity#post-47079</link>
			<pubDate>Sun, 22 Jan 2012 14:47:56 +0000</pubDate>
			<dc:creator>sjolshagen</dc:creator>
			<guid isPermaLink="false">47079@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I've got a form_pre_render() function created which reads a database table to determine whether a checkbox is supposed to be checked or not (this works fine). The form is then supposed to update the table on submit (have a gform_after_submission() function for that). &#60;/p&#62;
&#60;p&#62;Something odd is going on though. Every 10 days (the check boxes are one per day of the month), it seems either my code, php or the gforms code seems to &#34;skip&#34; an id so although the form displays properly (all days are there), the $entry traversal code gets messed up. The &#34;mess-up&#34; increments by 1 every 10 days so:&#60;/p&#62;
&#60;p&#62;&#38;lt;li class='gchoice_2_9'&#38;gt;&#38;lt;input name='input_2.9' type='checkbox'  value='9'  id='choice_2_9' tabindex='10'  /&#38;gt;&#38;lt;label for='choice_2_9'&#38;gt;Jan 9&#38;lt;/label&#38;gt;&#38;lt;li class='gchoice_2_11'&#38;gt;&#38;lt;input name='input_2.11' type='checkbox'  value='10'  id='choice_2_11' tabindex='11'  /&#38;gt;&#38;lt;label for='choice_2_11'&#38;gt;Jan 10&#38;lt;/label&#38;gt;&#60;/p&#62;
&#60;p&#62;The same thing happens on the 20th (ID skips 2_21) and the 30th.&#60;/p&#62;
&#60;p&#62;My code for creating the $choices and $inputs (apologies for the cut/paste as well as _ugly_ code:&#60;/p&#62;
&#60;p&#62;[SNIP]&#60;br /&#62;
    for ($i = 0; $i &#38;lt; $numDaysInMonth ; $i++)&#60;br /&#62;
    {&#60;br /&#62;
        $cnt = $i + 1;&#60;/p&#62;
&#60;p&#62;        $sqlStr = &#34;SELECT boolDay&#34; . $cnt . &#34; FROM ChallengeTracker WHERE ((strName='&#34; . $strName . &#34;') AND (numMonth=&#34; . $numMonth . &#34;));&#34;;&#60;br /&#62;
        $dbResult = $wpdb-&#38;gt;get_var( $wpdb-&#38;gt;prepare( $sqlStr ) );&#60;br /&#62;
        fprintf($fh, &#34;SQL: &#34; . $sqlStr . &#34;\n&#34;);&#60;/p&#62;
&#60;p&#62;        if ($dbResult != NULL) {&#60;br /&#62;
            fprintf($fh, &#34;Result returned: &#34; . $dbResult . &#34;\n&#34;);&#60;br /&#62;
        }&#60;/p&#62;
&#60;p&#62;        // We've located the day where&#60;br /&#62;
        if ($cnt == $numDay)&#60;br /&#62;
        {&#60;br /&#62;
            $strDayInfo = &#34;&#60;em&#62;&#34; . $arrMonth[$numMonthIndex] . &#34; &#34; . $cnt . &#34;&#60;/em&#62;&#34;;&#60;br /&#62;
        } else {&#60;br /&#62;
            $strDayInfo = $arrMonth[$numMonthIndex] . &#34; &#34; . $cnt;&#60;br /&#62;
        }&#60;/p&#62;
&#60;p&#62;        if ($dbResult != NULL)&#60;br /&#62;
        {&#60;br /&#62;
            $choices[] = array(&#34;text&#34; =&#38;gt; $strDayInfo, &#34;value&#34; =&#38;gt; $cnt, &#34;isSelected&#34; =&#38;gt; &#34;1&#34;);&#60;br /&#62;
        } else {&#60;br /&#62;
            $choices[] = array(&#34;text&#34; =&#38;gt; $strDayInfo, &#34;value&#34; =&#38;gt; $cnt);&#60;br /&#62;
        }&#60;/p&#62;
&#60;p&#62;       $inputs[] = array(&#34;label&#34; =&#38;gt; $arrMonth[$numMonthIndex] . &#34; &#34; . $cnt, &#34;id&#34; =&#38;gt; $numFieldID . &#34;.&#34; . $i);&#60;br /&#62;
    } // End of For Loop&#60;/p&#62;
&#60;p&#62;    //Adding items to field id $numFieldID&#60;br /&#62;
    foreach($form[&#34;fields&#34;] as &#38;amp;$field) {&#60;br /&#62;
        if($field[&#34;id&#34;] == $numFieldID) {&#60;br /&#62;
            $field[&#34;choices&#34;] = $choices;&#60;br /&#62;
            $field[&#34;inputs&#34;] = $inputs;&#60;br /&#62;
        }&#60;/p&#62;
&#60;p&#62;[SNIP]
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
