<?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: isSelected checkbox usage</title>
		<link>https://legacy.forums.gravityhelp.com/topic/isselected-checkbox-usage</link>
		<description>Gravity Support Forums Topic: isSelected checkbox usage</description>
		<language>en-US</language>
		<pubDate>Mon, 06 Apr 2026 22:02:50 +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/isselected-checkbox-usage" rel="self" type="application/rss+xml" />

		<item>
			<title>conduitstudios on "isSelected checkbox usage"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/isselected-checkbox-usage#post-29528</link>
			<pubDate>Fri, 08 Jul 2011 17:58:50 +0000</pubDate>
			<dc:creator>conduitstudios</dc:creator>
			<guid isPermaLink="false">29528@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;OK, I have cleaned up the code a little more. Just add the CSS class name custom_field_input_20 to your checkbox where input_20 is the name of a hidden field you want to get populated (not the Field Label but actually the name of the field if you view the source code of your form)&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_pre_submission_1&#38;quot;, &#38;quot;pre_submission_handler&#38;quot;);

function pre_submission_handler($form){

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

       if($field[&#38;#39;type&#38;#39;] != &#38;#39;checkbox&#38;#39; &#124;&#124; strpos($field[&#38;#39;cssClass&#38;#39;], &#38;#39;custom_field_&#38;#39;) === false)
            continue;

       $field_id = $field[&#38;#39;id&#38;#39;];
       $custom_field_name = str_replace(&#38;#39;custom_field_&#38;#39;, &#38;#39;&#38;#39;, $field[&#38;#39;cssClass&#38;#39;]);

		foreach($_POST as $key =&#38;gt; $value){

        if(strpos($key, &#38;quot;_{$field_id}_&#38;quot;) === false)
			continue;

		 $_POST[$custom_field_name] .= $value . &#38;quot;,&#38;quot;;
		}
	}

	return $form;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>conduitstudios on "isSelected checkbox usage"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/isselected-checkbox-usage#post-29527</link>
			<pubDate>Fri, 08 Jul 2011 17:39:45 +0000</pubDate>
			<dc:creator>conduitstudios</dc:creator>
			<guid isPermaLink="false">29527@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I figured it out.... someone owes me a hug. This is very similar to the add_checkbox_custom_fields, however this works on users as well. &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_pre_submission_1&#38;quot;, &#38;quot;pre_submission_handler&#38;quot;);

function pre_submission_handler($form){
	$values = &#38;quot;&#38;quot;;

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

        if($field[&#38;#39;type&#38;#39;] != &#38;#39;checkbox&#38;#39; &#124;&#124; strpos($field[&#38;#39;cssClass&#38;#39;], &#38;#39;custom_field_&#38;#39;) === false)
            continue;

        $field_id = $field[&#38;#39;id&#38;#39;];
        $custom_field_name = str_replace(&#38;#39;custom_field_&#38;#39;, &#38;#39;&#38;#39;, $field[&#38;#39;cssClass&#38;#39;]);

		foreach($_POST as $key =&#38;gt; $value){

            if(strpos($key, &#38;quot;_{$field_id}_&#38;quot;) === false)
                continue;

		   $values .= $value . &#38;quot;,&#38;quot;;

        }

	 }
	$_POST[&#38;quot;input_18&#38;quot;] = $values;
	return $form;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "isSelected checkbox usage"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/isselected-checkbox-usage#post-29512</link>
			<pubDate>Fri, 08 Jul 2011 15:02:42 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">29512@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I have forwarded this to one of our developers who is going to take a look and provide some feedback.  He is currently traveling so it may take some time for him to respond.  Bear in mind this is considered a customization so turnaround may not be as quick as for a standard support request.  But he should get to it relatively quickly.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>conduitstudios on "isSelected checkbox usage"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/isselected-checkbox-usage#post-29507</link>
			<pubDate>Fri, 08 Jul 2011 14:23:15 +0000</pubDate>
			<dc:creator>conduitstudios</dc:creator>
			<guid isPermaLink="false">29507@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I am having trouble figuring out the proper use of isSelected when it comes to checkboxes. Basically I want to find out if a checkbox has been selected. With the function below I am able to get the text, but I just can't seem to figure out how to detect if it is checked.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_pre_submission_1&#38;quot;, &#38;quot;pre_submission_handler&#38;quot;);

function pre_submission_handler($form){
	$industry = &#38;quot;&#38;quot;;
	foreach($form[&#38;#39;fields&#38;#39;] as &#38;amp;$field){
		if ($field[&#38;#39;type&#38;#39;] == &#38;#39;checkbox&#38;#39;) {
			foreach($field[&#38;#39;choices&#38;#39;] as $choice) {
				$industry  .= $choice[&#38;quot;text&#38;quot;] . &#38;quot;,&#38;quot;;
				$industry  .= $choice[&#38;quot;isSelected&#38;quot;] . &#38;quot;,&#38;quot;;
			}
		}
	}

   	$_POST[&#38;quot;input_18&#38;quot;] = $industry;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
