<?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: Automatically change value of multiple radio buttons</title>
		<link>https://legacy.forums.gravityhelp.com/topic/automatically-change-value-of-multiple-radio-buttons</link>
		<description>Gravity Support Forums Topic: Automatically change value of multiple radio buttons</description>
		<language>en-US</language>
		<pubDate>Sun, 19 Apr 2026 22:07:13 +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/automatically-change-value-of-multiple-radio-buttons" rel="self" type="application/rss+xml" />

		<item>
			<title>Jonnya on "Automatically change value of multiple radio buttons"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-change-value-of-multiple-radio-buttons#post-60908</link>
			<pubDate>Wed, 30 May 2012 23:24:49 +0000</pubDate>
			<dc:creator>Jonnya</dc:creator>
			<guid isPermaLink="false">60908@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Dang it! Anyone got any ideas on how to fix this please - my js above controls the multiple radio button sets perfectly - UNTIL you are also doing conditional display of fields controlled by said radio buttons... you have to click on the radio button twice to trigger the conditional display of the field;(
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Jonnya on "Automatically change value of multiple radio buttons"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-change-value-of-multiple-radio-buttons#post-60703</link>
			<pubDate>Tue, 29 May 2012 22:36:53 +0000</pubDate>
			<dc:creator>Jonnya</dc:creator>
			<guid isPermaLink="false">60703@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;If anyone else comes across this issue, here was my Javascript solution - works perfect for my radio buttons. Hope it helps someone else out - also works with multi-part forms!&#60;/p&#62;
&#60;p&#62;Basically this synchronizes fieldset values - so if you have multiple field sets down a page that all need to change if *one* is changed - this will do it. Although this was developed as a separate plugin, it should also work just fine in your theme functions file.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;#39;get_header&#38;#39;, &#38;#39;myplugin_gforms_multi_val_do&#38;#39;);

/*
* JS to control radio buttons where required
* //TODO: Change to required page(s) to include in right places
* @since 1.0
*/
function myplugin_gforms_multi_val_do() {
	if (is_page(&#38;#39;my-form-page&#38;#39;) &#124;&#124; is_page(&#38;#39;my-form-page-other&#38;#39;)) {
		add_action(&#38;#39;wp_enqueue_scripts&#38;#39;, &#38;#39;myplugin_gforms_multi_val_jq&#38;#39;);
		add_action(&#38;#39;wp_footer&#38;#39;, &#38;#39;myplugin_gforms_multi_val_js&#38;#39;);
	}
}

/*
* Insert JQuery to control radio buttons where required
* @since 1.0
*/
function myplugin_gforms_multi_val_jq() { wp_enqueue_script( &#38;#39;jquery&#38;#39; ); }

/*
 * Insert JS to control radio buttons where required
 * //TODO: Change $target_vals array to required fields
 * @since 1.0
 */
function myplugin_gforms_multi_val_js() {
	if (is_page(&#38;#39;testing&#38;#39;)) {

		$target_vals = array(&#38;#39;blue&#38;#39;,&#38;#39;red&#38;#39;,&#38;#39;gold&#38;#39;,&#38;#39;purple&#38;#39;);

		echo &#38;quot;\n&#38;quot;.&#38;#39;&#38;lt;script type=&#38;quot;text/javascript&#38;quot;&#38;gt;&#38;#39;;
		echo &#38;quot;\n&#38;quot;.&#38;#39;jQuery.noConflict();&#38;#39;;
		echo &#38;#39;jQuery(document).ready(function($) {&#38;#39;;

		foreach ($target_vals as $val) {
			echo &#38;quot;$(&#38;#39;[value=\&#38;quot;&#38;quot;.$val.&#38;quot;\&#38;quot;]&#38;#39;).change(function(){&#38;quot;;
			echo &#38;quot;$(&#38;#39;[value=\&#38;quot;&#38;quot;.$val.&#38;quot;\&#38;quot;]&#38;#39;).prop(&#38;#39;checked&#38;#39;,true);&#38;quot;;
			echo &#38;quot;});&#38;quot;;
		}

		echo &#38;quot;});&#38;quot;.&#38;quot;\n&#38;quot;;
		echo &#38;quot;&#38;lt;/script&#38;gt;&#38;quot;.&#38;quot;\n&#38;quot;;

	}
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Jonnya on "Automatically change value of multiple radio buttons"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/automatically-change-value-of-multiple-radio-buttons#post-60438</link>
			<pubDate>Fri, 25 May 2012 22:20:35 +0000</pubDate>
			<dc:creator>Jonnya</dc:creator>
			<guid isPermaLink="false">60438@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I've tried lots of different ways of doing this, but am having no luck at-all;( I would like to be able to have multiple sets of radio buttons as follows:&#60;/p&#62;
&#60;p&#62;radio buttons field 1:&#60;br /&#62;
&#38;lt;red&#38;gt;&#38;lt;blue&#38;gt;&#38;lt;green&#38;gt;&#60;/p&#62;
&#60;p&#62;radio buttons field 2: (further down form)&#60;br /&#62;
&#38;lt;red&#38;gt;&#38;lt;blue&#38;gt;&#38;lt;green&#38;gt;&#60;/p&#62;
&#60;p&#62;radio buttons field 3: (even further down form!)&#60;br /&#62;
&#38;lt;red&#38;gt;&#38;lt;blue&#38;gt;&#38;lt;green&#38;gt;&#60;/p&#62;
&#60;p&#62;When someone clicks &#38;lt;red&#38;gt; in any of the 3 fields above, I'd like the ALL of the radio buttons in each field set to change to 'red' wherever they appear on the form.&#60;/p&#62;
&#60;p&#62;I'm guessing this could be done with JQuery (already loaded on page) - but unfortunately I just can't work out how to do it (I'm a n00b at javascript...sorry!)&#60;/p&#62;
&#60;p&#62;I did try and setup multiple conditional displays of the radio button fields with the correct option selected - but the above is a very simplified example - and it was getting crazy with the amount of form fields I had (and I got some strange things happening) - this is not going to work for me.&#60;/p&#62;
&#60;p&#62;I certainly think JQuery could be the way forward on this targeting the field ID's but I just have no idea of where to start - any help would be appreciated thank you!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
