<?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: How to change/create new field variable?</title>
		<link>https://legacy.forums.gravityhelp.com/topic/how-to-changecreate-new-field-variable</link>
		<description>Gravity Support Forums Topic: How to change/create new field variable?</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 01:09:21 +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/how-to-changecreate-new-field-variable" rel="self" type="application/rss+xml" />

		<item>
			<title>jkirker on "How to change/create new field variable?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-changecreate-new-field-variable#post-222432</link>
			<pubDate>Wed, 24 Apr 2013 09:54:04 +0000</pubDate>
			<dc:creator>jkirker</dc:creator>
			<guid isPermaLink="false">222432@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks David...
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "How to change/create new field variable?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-changecreate-new-field-variable#post-222280</link>
			<pubDate>Wed, 24 Apr 2013 07:09:47 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">222280@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You would create a hidden field that would have the Allow this field to be populated dynamically checked off. Then you would use gform_pre_render to check for the cookie, grab the value and stuff it into your hidden field. &#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_pre_render&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_pre_render&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jkirker on "How to change/create new field variable?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-changecreate-new-field-variable#post-221327</link>
			<pubDate>Tue, 23 Apr 2013 18:18:29 +0000</pubDate>
			<dc:creator>jkirker</dc:creator>
			<guid isPermaLink="false">221327@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Hugo,&#60;/p&#62;
&#60;p&#62;I do something similar.  Did you get this resolved?&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
John
&#60;/p&#62;</description>
		</item>
		<item>
			<title>smaato on "How to change/create new field variable?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-changecreate-new-field-variable#post-54731</link>
			<pubDate>Tue, 10 Apr 2012 10:03:55 +0000</pubDate>
			<dc:creator>smaato</dc:creator>
			<guid isPermaLink="false">54731@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi GF team,&#60;/p&#62;
&#60;p&#62;I want to migrate my WPCF7 forms to GF but I need some help with the tracking. On WPCF7 I have a function that when someone lands on the website with this parameter on the URL &#34;myweb.com/?promo=mypromo&#34;, the it saves the &#34;mypromo&#34; as cookie for a 6 months period and if anyone contacts me, the &#34;mypromo&#34; comes attached.&#60;/p&#62;
&#60;p&#62;Question is, how to do this with GF. I am using GF integration with salesforce, all working smoothly btw, just this promocode thing not at all. I just don't know how to set a new variable in GF fields with the dynamic promocode call I need.&#60;/p&#62;
&#60;p&#62;This is the function I am using with WPCF7:&#60;/p&#62;
&#60;p&#62;&#38;lt;?php&#60;br /&#62;
function tracking_cookie(){&#60;br /&#62;
 if (!isset($_COOKIE['RD7cViG1mO6y'])) {&#60;br /&#62;
  setcookie('RD7cViG1mO6y',base64_encode($_GET['promo']), strtotime('+6 month'), '/', 'myweb.com');  //Tracks Promo code&#60;br /&#62;
  if (!isset($_COOKIE['qsJKX2zx3Le1'])) {&#60;br /&#62;
   setcookie('qsJKX2zx3Le1',base64_encode($_SERVER['HTTP_REFERER']),strtotime('+6 month'), '/', 'myweb.com');&#60;br /&#62;
  } //Tracks First Referrer to the website&#60;br /&#62;
 }&#60;br /&#62;
}&#60;br /&#62;
add_action('init','tracking_cookie',0);&#60;br /&#62;
wpcf7_add_shortcode( 'tracker', 'wpcf7_tracker_shortcode', true );&#60;/p&#62;
&#60;p&#62;function wpcf7_tracker_shortcode( $tag ) {&#60;br /&#62;
 global $wpcf7_contact_form;&#60;br /&#62;
 if ( ! is_array( $tag ) )&#60;br /&#62;
  return '';&#60;br /&#62;
 $name = $tag['name'];&#60;br /&#62;
 if (!isset($_COOKIE['RD7cViG1mO6y'])) {&#60;br /&#62;
  $tracker_code=$_GET['promo'];&#60;br /&#62;
 } else {&#60;br /&#62;
  $tracker_code=base64_decode($_COOKIE['RD7cViG1mO6y']);&#60;br /&#62;
 }&#60;br /&#62;
 $html = $html.'&#38;lt;input type=&#34;hidden&#34; name=&#34;'.$name.'&#34; value=&#34;'.$tracker_code.'&#34; /&#38;gt;';&#60;br /&#62;
 return $html;&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;wpcf7_add_shortcode( 'referrer', 'wpcf7_referrer_shortcode', true );&#60;br /&#62;
function wpcf7_referrer_shortcode( $tag ) {&#60;br /&#62;
 global $wpcf7_contact_form;&#60;br /&#62;
 if ( ! is_array( $tag ) )&#60;br /&#62;
  return '';&#60;br /&#62;
 $name = $tag['name'];&#60;br /&#62;
 if (!isset($_COOKIE['qsJKX2zx3Le1'])) {&#60;br /&#62;
  $referrer=$_SERVER['HTTP_REFERER'];&#60;br /&#62;
 } else {&#60;br /&#62;
  $referrer=base64_decode($_COOKIE['qsJKX2zx3Le1']);&#60;br /&#62;
 }&#60;br /&#62;
 $html = $html.'&#38;lt;input type=&#34;hidden&#34; name=&#34;'.$name.'&#34; value=&#34;'.$referrer.'&#34; /&#38;gt;';&#60;br /&#62;
 return $html;&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;?&#38;gt;&#60;/p&#62;
&#60;p&#62;than I set [promo_code] and [referrer_link] in WPCF7 mail and this is how I have been using.&#60;/p&#62;
&#60;p&#62;Can someone help me making this work on a GF hidden promocode field? (btw my salesforce promocode parameter is &#34;Promo_Code__c&#34;).&#60;/p&#62;
&#60;p&#62;Appreciate.&#60;br /&#62;
Hugo
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
