<?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: Explicitly set default radio choice using hook</title>
		<link>https://legacy.forums.gravityhelp.com/topic/explicitly-set-default-radio-choice-using-hook</link>
		<description>Gravity Support Forums Topic: Explicitly set default radio choice using hook</description>
		<language>en-US</language>
		<pubDate>Sat, 04 Apr 2026 06:14:51 +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/explicitly-set-default-radio-choice-using-hook" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Explicitly set default radio choice using hook"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/explicitly-set-default-radio-choice-using-hook#post-142090</link>
			<pubDate>Tue, 05 Feb 2013 01:11:11 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">142090@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Great. Thanks very much for the update.  Let us know if you need any more help going forward.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mobiah on "Explicitly set default radio choice using hook"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/explicitly-set-default-radio-choice-using-hook#post-142087</link>
			<pubDate>Tue, 05 Feb 2013 01:10:02 +0000</pubDate>
			<dc:creator>mobiah</dc:creator>
			<guid isPermaLink="false">142087@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Just wanted to drop you one last note to let you know that your solution was absolutely perfect for my needs, and I went ahead and used it in favor of the js that I wrote. Feels cleaner to set the correct radio button before the form renders, and the js that I put in place would sometimes have a slight delay before setting the radio button correctly (though the fact that I noticed it was probably more due to the slow server I am building this project on).
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Explicitly set default radio choice using hook"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/explicitly-set-default-radio-choice-using-hook#post-142059</link>
			<pubDate>Tue, 05 Feb 2013 00:49:50 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">142059@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You're welcome. I learned something in the process too.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mobiah on "Explicitly set default radio choice using hook"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/explicitly-set-default-radio-choice-using-hook#post-141753</link>
			<pubDate>Mon, 04 Feb 2013 18:44:17 +0000</pubDate>
			<dc:creator>mobiah</dc:creator>
			<guid isPermaLink="false">141753@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks! I may prefer your solution over the javascript I am currently using. I'll most likely test it out this afternoon. At a minimum, your example gives me better insight into how to work with the Field Object, so that is great. Thanks again!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Explicitly set default radio choice using hook"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/explicitly-set-default-radio-choice-using-hook#post-138958</link>
			<pubDate>Fri, 01 Feb 2013 20:51:13 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">138958@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I tried a couple things with this and made this code work:&#60;br /&#62;
&#60;a href=&#34;http://pastebin.com/PUvFxxTd&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/PUvFxxTd&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I looped through each radio button choice.  I don't know if that matters or not.  I discovered if I had a selection made in the form builder and I was trying to set an earlier option as selected, the later one would always render as selected.  So I clear out all the other isSelected choices.&#60;/p&#62;
&#60;p&#62;I tested for the value of the radio button choice before making it selected.  Not sure if that will work in your situation.&#60;/p&#62;
&#60;p&#62;I also used &#34;true&#34; instead of &#34;1&#34;, but I'm not sure if that mattered.&#60;/p&#62;
&#60;p&#62;This code worked for me.  Let me know if anything in there helps you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mobiah on "Explicitly set default radio choice using hook"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/explicitly-set-default-radio-choice-using-hook#post-138838</link>
			<pubDate>Fri, 01 Feb 2013 17:30:08 +0000</pubDate>
			<dc:creator>mobiah</dc:creator>
			<guid isPermaLink="false">138838@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I ended up using a bit of javascript to make this happen. If there is a way of doing it through a hook when the form loads, I'd still be interested in knowing it. Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mobiah on "Explicitly set default radio choice using hook"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/explicitly-set-default-radio-choice-using-hook#post-137734</link>
			<pubDate>Thu, 31 Jan 2013 16:47:23 +0000</pubDate>
			<dc:creator>mobiah</dc:creator>
			<guid isPermaLink="false">137734@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;Might be right in front of my face, but I haven't found a way to get this working. I'd like to dynamically set the default radio button selection using a hook like gform_pre_render. I've be trying things along the lines of the attached code. &#60;/p&#62;
&#60;p&#62;Essentially, I could use help understanding how to force the form to have a choice (doesn't matter which) selected upon page load. If I can get there, I believe I can take it the rest of the way myself. Any help is much appreciated!&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter( &#38;quot;gform_pre_render_3&#38;quot;, &#38;quot;set_default_dynamically&#38;quot; );

function set_default_dynamically($form) {

    foreach( $form[&#38;quot;fields&#38;quot;] as $field ){
        if( $field[&#38;quot;id&#38;quot;] == 4 ){
           $field[&#38;quot;choices&#38;quot;][0][&#38;quot;isSelected&#38;quot;] = 1;
        }
    }
    return $form;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
