<?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: Appending checkbox to beginning of checkbox list</title>
		<link>https://legacy.forums.gravityhelp.com/topic/appending-checkbox-to-beginning-of-checkbox-list</link>
		<description>Gravity Support Forums Topic: Appending checkbox to beginning of checkbox list</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 07:15:05 +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/appending-checkbox-to-beginning-of-checkbox-list" rel="self" type="application/rss+xml" />

		<item>
			<title>sanz on "Appending checkbox to beginning of checkbox list"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/appending-checkbox-to-beginning-of-checkbox-list#post-54988</link>
			<pubDate>Wed, 11 Apr 2012 18:59:44 +0000</pubDate>
			<dc:creator>sanz</dc:creator>
			<guid isPermaLink="false">54988@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hey Rob ... unfortunately the form is not publicly accessible at the moment.&#60;/p&#62;
&#60;p&#62;I've ended up using jQuery to unselect the single checkbox on display and am not worrying about the id for now.&#60;/p&#62;
&#60;p&#62;I think there may still be an issue there however I'll have to send through the form manually to you after I've finished the project I'm working on.&#60;/p&#62;
&#60;p&#62;Could also just be my crappy code messing up somewhere ;-)&#60;/p&#62;
&#60;p&#62;Thanks anyway.&#60;/p&#62;
&#60;p&#62;Scott
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Rob Harrell on "Appending checkbox to beginning of checkbox list"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/appending-checkbox-to-beginning-of-checkbox-list#post-54621</link>
			<pubDate>Mon, 09 Apr 2012 11:35:14 +0000</pubDate>
			<dc:creator>Rob Harrell</dc:creator>
			<guid isPermaLink="false">54621@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hey Scott, anyway we could see a link to the form too?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sanz on "Appending checkbox to beginning of checkbox list"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/appending-checkbox-to-beginning-of-checkbox-list#post-54605</link>
			<pubDate>Mon, 09 Apr 2012 10:51:33 +0000</pubDate>
			<dc:creator>sanz</dc:creator>
			<guid isPermaLink="false">54605@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hey all ... just wondering if I'm encountering a bug or not with gform_pre_render.&#60;/p&#62;
&#60;p&#62;Using the following gform_pre_render filter to populate checkboxes:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_pre_render_6&#38;quot;, &#38;#39;selected_location_checkboxes&#38;#39;);
add_filter(&#38;quot;gform_admin_pre_render_6&#38;quot;, &#38;#39;selected_location_checkboxes&#38;#39;);
function selected_location_checkboxes($form){
	global $current_user;
	get_currentuserinfo();

    $choices = array();
    $inputs = array();
	$args = array( &#38;#39;hide_empty&#38;#39; =&#38;gt; 0, &#38;#39;taxonomy&#38;#39;=&#38;gt; &#38;#39;location&#38;#39;); // custom taxonomy
    $categories = get_categories($args);

array_push($choices, array(&#38;quot;text&#38;quot; =&#38;gt; &#38;#39;All/None&#38;#39;, &#38;quot;value&#38;quot; =&#38;gt; &#38;#39;&#38;#39;, &#38;quot;isSelected&#38;quot; =&#38;gt; false));
array_push($inputs, array(&#38;quot;label&#38;quot; =&#38;gt; &#38;#39;All/None&#38;#39;, &#38;quot;id&#38;quot; =&#38;gt; &#38;#39;selectAllLocations&#38;#39;));

	$i = 1;
	foreach ($categories as $category) {
		$field_id = &#38;quot;17.&#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;term_id, &#38;quot;isSelected&#38;quot; =&#38;gt; (is_object_in_term( $current_user-&#38;gt;ID, &#38;#39;location&#38;#39;, $category ) ) ? true : false ));
		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++;
	}

    foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field){
        if($field[&#38;quot;id&#38;quot;] == 17){
            $field[&#38;quot;choices&#38;quot;] = $choices;
            $field[&#38;quot;inputs&#38;quot;] = $inputs;
        }
    }

    return $form;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;As can be seen I'm attempting to add an initial checkbox with All/None as the text and no value and not selected.&#60;/p&#62;
&#60;p&#62;It gets output as a checkbox on the front end however for some reason it is always marked as &#34;checked&#34;. It's also automatically given an id of &#34;choice_17_1&#34; and NOT &#34;selectAllLocations&#34; as I need.&#60;/p&#62;
&#60;p&#62;I'm trying to output a checkbox that can be used to select/deselect all other checkboxes on this field and need one checkbox that is not by default selected and also with a id of my choosing.&#60;/p&#62;
&#60;p&#62;Anyone know if this is a bug or am I missing something? Anyone done this before?&#60;/p&#62;
&#60;p&#62;Thanks&#60;/p&#62;
&#60;p&#62;Scott
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
