<?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: Using custom fields to populate hidden fields</title>
		<link>https://legacy.forums.gravityhelp.com/topic/using-custom-fields-to-populate-hidden-fields</link>
		<description>Gravity Support Forums Topic: Using custom fields to populate hidden fields</description>
		<language>en-US</language>
		<pubDate>Sun, 19 Apr 2026 20:22:08 +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/using-custom-fields-to-populate-hidden-fields" rel="self" type="application/rss+xml" />

		<item>
			<title>Carl Hancock on "Using custom fields to populate hidden fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/using-custom-fields-to-populate-hidden-fields#post-17732</link>
			<pubDate>Sat, 05 Feb 2011 14:58:57 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">17732@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Glad to hear you got it working Mark.  Gravity Forms does a lot out of the box and can do even more if you put the hooks/filters to work to customize it.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bandolero on "Using custom fields to populate hidden fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/using-custom-fields-to-populate-hidden-fields#post-17721</link>
			<pubDate>Sat, 05 Feb 2011 11:14:02 +0000</pubDate>
			<dc:creator>bandolero</dc:creator>
			<guid isPermaLink="false">17721@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Carl&#60;/p&#62;
&#60;p&#62;Thanks for the reply and information.&#60;/p&#62;
&#60;p&#62;Yep, you're right about the variables - in my first post I did mention about populating them using get_post_meta which is why I was getting super confused - not to mention calling the GF inside the template file and the function in the template file too - I had read on the codex when modifying the theme about using them inside the loop too as you pointed out - which I thought I was doing. So armed with your information I did some more reading and worked out the following&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_field_value_propertyid&#38;quot;, &#38;quot;populate_propertyid&#38;quot;);
function populate_propertyid($value){
return get_post_meta(get_the_ID(),&#38;#39;property_feed_id&#38;#39;,true);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I swapped out get_post_meta for get_the_id&#60;/p&#62;
&#60;p&#62;And it worked.&#60;/p&#62;
&#60;p&#62;Many thanks for your help and patience. I'm going to build the rest of the form and go from there and hopefully get it all working.&#60;/p&#62;
&#60;p&#62;Mark
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Using custom fields to populate hidden fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/using-custom-fields-to-populate-hidden-fields#post-17672</link>
			<pubDate>Fri, 04 Feb 2011 15:05:29 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">17672@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Are you setting the value of the variable $property_feed_id somewhere else on your site?&#60;/p&#62;
&#60;p&#62;I ask because WordPress custom fields aren't accessed that way.  You have to query the post meta to get the custom field value.  If property_feed_id is the key for that custom field, you have to query post meta to get the value for that key.  Simply returning $property_feed_id isn't going to work unless you have created the $property_feed_id variable and set it's value equal to the property_feed_id custom field.&#60;/p&#62;
&#60;p&#62;Try this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
add_filter(&#38;quot;gform_field_value_propertyid&#38;quot;, &#38;quot;populate_propertyid&#38;quot;);
function populate_propertyid($value){
return &#38;quot;TESTID&#38;quot;;
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;See if that code stores &#34;TESTID&#34; as the value of the hidden field.  If it does, then the code above is working fine. It's just a matter of you implementing the write code to return the custom field.  Right now it's returning nothing because $property_feed_id doesn't exist as a variable because it's a custom field.  &#60;/p&#62;
&#60;p&#62;Here is how you would get the value of a custom field in WordPress using code:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;get_post_meta($post-&#38;gt;ID, &#38;#39;property_feed_id&#38;#39;, true);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;In order to get the value of a custom field this way it has to be placed within the loop that displays your post.  So it would have to go in your theme template file, not in your functions.php file.&#60;/p&#62;
&#60;p&#62;I haven't tested this but what you want is going to look something like this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
add_filter(&#38;quot;gform_field_value_propertyid&#38;quot;, &#38;quot;populate_propertyid&#38;quot;);
function populate_propertyid($value){
return get_post_meta($post-&#38;gt;ID, &#38;#39;property_feed_id&#38;#39;, true);
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>bandolero on "Using custom fields to populate hidden fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/using-custom-fields-to-populate-hidden-fields#post-17649</link>
			<pubDate>Fri, 04 Feb 2011 11:10:10 +0000</pubDate>
			<dc:creator>bandolero</dc:creator>
			<guid isPermaLink="false">17649@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Carl&#60;/p&#62;
&#60;p&#62;Thanks for the swift reply. I think I followed what you mean though I can't get the value of the field to populate using the method described above. I've tried the following.&#60;/p&#62;
&#60;p&#62;propertyid is the parameter name for the hidden field I want to populate dynamically. $property_feed_id is my custom field as mentioned above.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
add_filter(&#38;quot;gform_field_value_propertyid&#38;quot;, &#38;quot;populate_propertyid&#38;quot;);
function populate_propertyid($property_feed_id){
return $property_feed_id;
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
add_filter(&#38;quot;gform_field_value_propertyid&#38;quot;, &#38;quot;populate_propertyid&#38;quot;);
function populate_propertyid($value){
return $property_feed_id;
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;That would be ace if you were set the default value of a field from a custom field key. I can see them available when creating a field for submission which I think is great.&#60;/p&#62;
&#60;p&#62;Thanks for your help.&#60;br /&#62;
Mark
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Using custom fields to populate hidden fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/using-custom-fields-to-populate-hidden-fields#post-17616</link>
			<pubDate>Thu, 03 Feb 2011 22:06:15 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">17616@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You are on the right track, but approaching it wrong.&#60;/p&#62;
&#60;p&#62;When you set a field to be populated dynamically, the parameter name isn't code.  It's a parameter name that you would then use to populate the field dynamically via the query string or using PHP code.&#60;/p&#62;
&#60;p&#62;For instance, if I had an Email field on my form and I set the Email field to be populated dynamically and give it a parameter name of &#34;email&#34; I could then populate it using the querystring by passing email= in the query string when calling that page. (ex. mydomain.com/mypage?email=VALUE).  In this case &#34;email&#34; is the parameter name and is what I use to target that field.&#60;/p&#62;
&#60;p&#62;You are trying to use it to populate it with a variable name, which isn't how you would do this.&#60;/p&#62;
&#60;p&#62;If you want to populate a field dynamically using PHP, which is what you would want to do if you want to populate it with the value of a custom field, you would have to do so with PHP.  Here is an example of how you would pre-populate a field using PHP, this example assumes the parameter name for the field is &#34;date&#34;.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
add_filter(&#38;quot;gform_field_value_date&#38;quot;, &#38;quot;populate_date&#38;quot;);
function populate_date($value){
return &#38;quot;10/10/2010&#38;quot;;
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;This example pre-populate the field you have given a parameter name of &#34;date&#34; with the value of &#34;10/10/2010&#34;.  To do what you would want to do you would return the value of the custom field instead.&#60;/p&#62;
&#60;p&#62;This code would be placed in your theme template file or functions.php depending on how you implement it.&#60;/p&#62;
&#60;p&#62;We can look into adding the ability to set the default value of a field using a custom field key, it's a good idea and makes sense as a built in feature so that you can do so without having to write code.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bandolero on "Using custom fields to populate hidden fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/using-custom-fields-to-populate-hidden-fields#post-17590</link>
			<pubDate>Thu, 03 Feb 2011 17:27:58 +0000</pubDate>
			<dc:creator>bandolero</dc:creator>
			<guid isPermaLink="false">17590@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hello everyone&#60;/p&#62;
&#60;p&#62;I'm new to GF and so far I've been really impressed by the wealth of information available on the support forum and in the documentation. The plugin is brilliant too.&#60;/p&#62;
&#60;p&#62;How ever I've hit a brickwall and after 2 hours of reading I need help.&#60;/p&#62;
&#60;p&#62;I have a heavily customised Wootheme [ Estate ] that's using a live feed of residential and commerical properties. On each property page that's a button that allows you to 'request a viewing' for one of these properties. &#60;/p&#62;
&#60;p&#62;The theme comes with a 'contact-form' template that I started to hack. The out of the box contact form grabs the ID of the property from the querystring and populates an input field. However I need much more information than this so I bought GF.&#60;/p&#62;
&#60;p&#62;What I'd like to do is embed a GF inside the property page - I understand how to do this.&#60;/p&#62;
&#60;p&#62;The form will request fields such as name, email, telephone number etc from the person who's requesting the viewing.&#60;/p&#62;
&#60;p&#62;How ever I'd like to populate several hidden fields with variables that contain the ID of the property, the address of the property and the location of the property and have those fields included in the email that I receive on submission of the form.&#60;/p&#62;
&#60;p&#62;I've got some custom fields set up in the PHP page that displays the property and will have the embedded GF.&#60;/p&#62;
&#60;p&#62;They're set up like this to use in the page&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$property_feed_id = get_post_meta($post-&#38;gt;ID,&#38;#39;feed_id&#38;#39;,true);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;and&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$property_address = get_post_meta($post-&#38;gt;ID,&#38;#39;address&#38;#39;,true);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;If the GF is embedded in the page that displays the property, is it not possible to populate some hidden fields with this variables using the GF interface. As that information is already available in the page?&#60;/p&#62;
&#60;p&#62;I've tried clicking 'Allow field to be populated dynamically ' and then in the parameter box tried a combination of adding $property_address / $property_feed_id etc&#60;/p&#62;
&#60;p&#62;Or am I approaching this totally wrong? Should I be trying to post all this information in the querystring and building a form to operate similar to the Woothemes contact form? Is that the most elegant way of doing it?&#60;/p&#62;
&#60;p&#62;Ideally I wanted the form to be available in the property page itself. The software that provides the feed scrapes the inbox where the &#34;request a viewing' submission lands and uses the ID of the property to generate a lead. Hence needing that information. I tried hacking the Woothemes Contact Form and it was turned out to be hassle. I hope GF hits the mark in what I'm trying to do.&#60;/p&#62;
&#60;p&#62;Hope all this makes sense and someone can help or point me in the right direction.&#60;/p&#62;
&#60;p&#62;Thanks in advance&#60;br /&#62;
Mark
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
