<?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: dynamically populate form with short code exec</title>
		<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-form-with-short-code-exec</link>
		<description>Gravity Support Forums Topic: dynamically populate form with short code exec</description>
		<language>en-US</language>
		<pubDate>Sun, 19 Apr 2026 23:27:30 +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/dynamically-populate-form-with-short-code-exec" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "dynamically populate form with short code exec"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-form-with-short-code-exec#post-183120</link>
			<pubDate>Sun, 24 Mar 2013 16:02:25 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">183120@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Please try this code instead:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
add_filter(&#38;quot;gform_field_value_filename&#38;quot;, &#38;quot;filename_in&#38;quot;);
function filename_in($value){

	// only process this code for form ID 1
	if ($form[&#38;#39;id&#38;#39;] != 1)
		return;

	$code = substr($_SERVER[&#38;#39;QUERY_STRING&#38;#39;],5,12);
	$filename = str_replace(array(&#38;#39;-0&#38;#39;, &#38;#39;-1&#38;#39;),array(&#38;#39;-A&#38;#39;, &#38;#39;-B&#38;#39;), $code);
	$value = $filename;
	return $value;

}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Assuming your function worked to extract the filename from the QUERY_STRING, this will run your 'filename_in' function and will populate a field in your form which has been checked &#34;allow field to be populated dynamically&#34; (on the advanced tab for that field) and was given a parameter name of 'filename'.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jimlongo on "dynamically populate form with short code exec"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-form-with-short-code-exec#post-180275</link>
			<pubDate>Fri, 22 Mar 2013 00:17:34 +0000</pubDate>
			<dc:creator>jimlongo</dc:creator>
			<guid isPermaLink="false">180275@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks Chris, I'm trying to store the image filename. I see what you mean value_foo will display the results of the function where foo is the parameter in the form setup. &#60;/p&#62;
&#60;p&#62;Eventually I will be interested in displaying the photo, if you could briefly explain that as well that would be appreciated.&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
jim
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "dynamically populate form with short code exec"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-form-with-short-code-exec#post-179811</link>
			<pubDate>Thu, 21 Mar 2013 15:37:33 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">179811@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;gform_field_input is used to change the field input tag in the HTML source of the form when the form is rendered.  From reading your comments, I don't think that's what you want to do?  I think I would use gform_field_value_photo (or whatever your field is called where you want to store the filename.)&#60;/p&#62;
&#60;p&#62;Are you trying to display the image in your form, or trying to store the image filename in a form field?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jimlongo on "dynamically populate form with short code exec"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-form-with-short-code-exec#post-177199</link>
			<pubDate>Tue, 19 Mar 2013 18:30:12 +0000</pubDate>
			<dc:creator>jimlongo</dc:creator>
			<guid isPermaLink="false">177199@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I've tried adding just the gform_field_input in nearly every conceivable spot in the functions.php file.&#60;/p&#62;
&#60;p&#62;It does one of two things.&#60;/p&#62;
&#60;p&#62;1. Nothing&#60;br /&#62;
2. It prints the result i want, but the form disappears and it just prints it onscreen. &#60;/p&#62;
&#60;p&#62;I just put the filter and function in my custom plugin file, and I get result #2 above.&#60;/p&#62;
&#60;p&#62;Please, What is wrong with my filter action?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jimlongo on "dynamically populate form with short code exec"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-form-with-short-code-exec#post-177062</link>
			<pubDate>Tue, 19 Mar 2013 15:15:55 +0000</pubDate>
			<dc:creator>jimlongo</dc:creator>
			<guid isPermaLink="false">177062@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Has something to do with where the hooks are added in functions.php&#60;/p&#62;
&#60;p&#62;Sometimes I get nothing.&#60;br /&#62;
Sometimes I get results, but the form fields are gong, the results are printed on the page!?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jimlongo on "dynamically populate form with short code exec"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-form-with-short-code-exec#post-176959</link>
			<pubDate>Tue, 19 Mar 2013 13:18:18 +0000</pubDate>
			<dc:creator>jimlongo</dc:creator>
			<guid isPermaLink="false">176959@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_field_input&#38;quot;, &#38;quot;filename_in&#38;quot;, 10, 5);
function filename_in($input, $field, $value, $lead_id, $form_id){

	$code = substr($_SERVER[&#38;#39;QUERY_STRING&#38;#39;],5,12);
	$filename = str_replace(array(&#38;#39;-0&#38;#39;, &#38;#39;-1&#38;#39;),array(&#38;#39;-A&#38;#39;, &#38;#39;-B&#38;#39;), $code);

	if ($form_id == 1 &#38;amp;&#38;amp; $field[&#38;quot;id&#38;quot;] == 1){
		$value = $filename;
	}

	return $value;

}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;and using input as the dynamic parameter in the form?&#60;/p&#62;
&#60;p&#62;i can print $filename it is 12345-A, I want to populate the field with that data.&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
jim
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jimlongo on "dynamically populate form with short code exec"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-form-with-short-code-exec#post-176925</link>
			<pubDate>Tue, 19 Mar 2013 12:26:55 +0000</pubDate>
			<dc:creator>jimlongo</dc:creator>
			<guid isPermaLink="false">176925@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Chris, I guess when you say shortcode you are talking about a gform shortcode. If that's right, I guess a hook would be more appropriate. &#60;/p&#62;
&#60;p&#62;I'm trying to get an example to work.&#60;br /&#62;
I'm using the hard coded date example in a date field. I've put the following in my theme&#38;gt;functions.php file.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;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;;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I've checked the dynamic checkbox and entered &#34;date&#34; as the parameter.&#60;br /&#62;
The field is still empty.  What else do I need to know.&#60;br /&#62;
I tried populate_date as the parameter as well as populate_date($value) but no result yet.&#60;/p&#62;
&#60;p&#62;I'm thinking if I get that to work, then I can use the gform_field_input or gform_field_content hook to populate the field with my data?&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
jim
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jimlongo on "dynamically populate form with short code exec"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-form-with-short-code-exec#post-176725</link>
			<pubDate>Tue, 19 Mar 2013 08:59:19 +0000</pubDate>
			<dc:creator>jimlongo</dc:creator>
			<guid isPermaLink="false">176725@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks Chris.&#60;/p&#62;
&#60;p&#62;I have some data that refers to a photo. It is currently in the URL in the form of xyz.com/?code=12345A (1235A refers to a file on a CDN).  &#60;/p&#62;
&#60;p&#62;Both this filename and the url to that file are contained in the $_SESSION array as ['images']['filename'] and ['images']['url']&#60;/p&#62;
&#60;p&#62;In both cases I've previously been using shortcode-exec PHP to (as a way to use snippets of php in wordpress posts) to display these items when I need them.  I'm open to any way of grabbing them for the purpose of using them in my form.&#60;/p&#62;
&#60;p&#62;I'd like to get those items into 2 fields.  &#34;Filename&#34; and &#34;URL&#34;.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "dynamically populate form with short code exec"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-form-with-short-code-exec#post-176694</link>
			<pubDate>Tue, 19 Mar 2013 08:34:54 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">176694@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;To use the query string, you need to send the parameters in the URL, like this:&#60;br /&#62;
&#60;a href=&#34;http://gravity.chrishajer.com/family-reunion-rsvp/?st=Illinois,Indiana,Nevada,Alabama,Confusion&#34; rel=&#34;nofollow&#34;&#62;http://gravity.chrishajer.com/family-reunion-rsvp/?st=Illinois,Indiana,Nevada,Alabama,Confusion&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I have a field set up for dynamic population (my list of states) and a parameter name of 'st'.  Then, I can send the individual states in the query string as shown above.  There is no need for the shortcode-exec plugin and I'm not sure how that comes into play.&#60;/p&#62;
&#60;p&#62;Please explain more what you're trying to do.  If you're trying to use the shortcode-exec plugin to populate a field in your form, it's possible you aren't using the query string at all.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jimlongo on "dynamically populate form with short code exec"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populate-form-with-short-code-exec#post-176371</link>
			<pubDate>Tue, 19 Mar 2013 02:59:51 +0000</pubDate>
			<dc:creator>jimlongo</dc:creator>
			<guid isPermaLink="false">176371@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi, I just purchased Gravity Forms and want to populate a field with some data from a query string. I use Shortcode-exec php to get the data I want. I can print it I know that it's there.&#60;/p&#62;
&#60;p&#62;I put that shortcode in the Parameter Name box and check that the field can be populated dynamically.&#60;/p&#62;
&#60;p&#62;I'm not clear what kind of field it should be.  But I can't get any data to show up in that field.&#60;/p&#62;
&#60;p&#62;Any advice on how to proceed.&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
jim
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
