<?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: Populating a hidden field based on dropdown selection</title>
		<link>https://legacy.forums.gravityhelp.com/topic/populating-a-hidden-field-based-on-dropdown-selection</link>
		<description>Gravity Support Forums Topic: Populating a hidden field based on dropdown selection</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 07:56: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/populating-a-hidden-field-based-on-dropdown-selection" rel="self" type="application/rss+xml" />

		<item>
			<title>thepresident on "Populating a hidden field based on dropdown selection"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populating-a-hidden-field-based-on-dropdown-selection#post-31114</link>
			<pubDate>Thu, 28 Jul 2011 07:12:04 +0000</pubDate>
			<dc:creator>thepresident</dc:creator>
			<guid isPermaLink="false">31114@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks Carl.&#60;/p&#62;
&#60;p&#62;So rather than using a hidden field, I just need to send the value of the dropdown to the required custom field?&#60;br /&#62;
I've changed the values of the example you directed me to, but haven't managed to get it to work. It looks like this so far:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_post_submission&#38;quot;, &#38;quot;add_custom_field&#38;quot;, 10, 2);
function add_custom_field($entry, $form){
    //NOTE: replace 1 with the ID of your form.
    if($form[&#38;quot;id&#38;quot;] != 9)
       return;

    //getting post meta
    $meta = get_post_meta($entry[&#38;quot;post_id&#38;quot;], &#38;#39;key&#38;#39;, true);

    //updating price property of array.
    //NOTE: replace &#38;quot;1&#38;quot; with the ID of the field you want to populate the price field.
    $meta[&#38;quot;ranking&#38;quot;] = $entry[&#38;quot;30&#38;quot;];

    //updating meta
    update_post_meta($entry[&#38;quot;post_id&#38;quot;], &#38;quot;key&#38;quot;, $meta);

}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Thanks, sorry PHP isn't my strong point!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Populating a hidden field based on dropdown selection"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populating-a-hidden-field-based-on-dropdown-selection#post-30968</link>
			<pubDate>Tue, 26 Jul 2011 11:28:00 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">30968@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You would access and manipulate the Entry objet via the gform_post_submission.  The fields would be accessed by their ID in the code, not by their name.  Each field has a Field ID, which you can get by viewing the source of the form and seeing the ID.  The Entry object is documented here:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Entry_Object&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Entry_Object&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I would suggest searching around the forum for information on things like populating custom fields.  Here is one thread I found that has example code:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.gravityhelp.com/forums/topic/map-form-field-to-custom-field-located-in-an-array&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/forums/topic/map-form-field-to-custom-field-located-in-an-array&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;When the $entry object is accessed the number being used is the field id.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>thepresident on "Populating a hidden field based on dropdown selection"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populating-a-hidden-field-based-on-dropdown-selection#post-30949</link>
			<pubDate>Tue, 26 Jul 2011 04:08:54 +0000</pubDate>
			<dc:creator>thepresident</dc:creator>
			<guid isPermaLink="false">30949@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Carl&#60;/p&#62;
&#60;p&#62;Thanks for getting back to me. Unfortunately I'm pretty new to php so I am trying to work though the example you gave. &#60;/p&#62;
&#60;p&#62;I have amended the example to select the specific form, how to I format it so that I take the value from the dropdown and populate it into the hidden custom field? Is &#34;Blender Version:&#34; in the example the source (dropdown in my case)?&#60;/p&#62;
&#60;p&#62;Thanks
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Populating a hidden field based on dropdown selection"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populating-a-hidden-field-based-on-dropdown-selection#post-30893</link>
			<pubDate>Mon, 25 Jul 2011 13:05:31 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">30893@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You would have to do this with custom code you would add to your themes functions.php file to customize what that form does when it is submitted. You would use the gform_post_submission hook to take the value of the drop down field and update the hidden field with that value.  &#60;/p&#62;
&#60;p&#62;The gform_post_submission hook is documented here:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_post_submission&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_post_submission&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>thepresident on "Populating a hidden field based on dropdown selection"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populating-a-hidden-field-based-on-dropdown-selection#post-30862</link>
			<pubDate>Mon, 25 Jul 2011 06:59:09 +0000</pubDate>
			<dc:creator>thepresident</dc:creator>
			<guid isPermaLink="false">30862@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;I have created a dropdown, and I want to pass the value that's selected to a hidden field when it's submitted.&#60;/p&#62;
&#60;p&#62;Basically the form is used for submitted an advert, the dropdown is the number of images they require in the ad (options are 1-5), and the more images they submit, the higher they need to be in the listings. The dropdown is also a pricing field, which passes the value to the total. I just need to pass the dropdowns value to a hidden custom field, which is used to order the posts on the output page.&#60;/p&#62;
&#60;p&#62;Can anyone offer some advice on what I need to do?&#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
