<?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: Can&#039;t seem to change $form</title>
		<link>https://legacy.forums.gravityhelp.com/topic/cant-seem-to-change-form</link>
		<description>Gravity Support Forums Topic: Can&#039;t seem to change $form</description>
		<language>en-US</language>
		<pubDate>Sat, 04 Apr 2026 15:29:52 +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/cant-seem-to-change-form" rel="self" type="application/rss+xml" />

		<item>
			<title>iamcanadian1973 on "Can&#039;t seem to change $form"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/cant-seem-to-change-form#post-34201</link>
			<pubDate>Fri, 02 Sep 2011 03:48:13 +0000</pubDate>
			<dc:creator>iamcanadian1973</dc:creator>
			<guid isPermaLink="false">34201@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I ended up solving my problem but I wish I knew why my previous solution did niot work.'&#60;br /&#62;
New solution:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_pre_submission&#38;quot;, &#38;quot;pre_submission_handler&#38;quot;);
function pre_submission_handler($form){
    //creating list of emails based on fields on the form
    $price  = $_POST[&#38;quot;input_2&#38;quot;]; //player 1 email

	$coupon = trim( $_POST[&#38;#39;input_6&#38;#39;] );

   $codes = array(

   			&#38;#39;27&#38;#39; =&#38;gt; &#38;#39;abc27&#38;#39;,
            &#38;#39;25&#38;#39; =&#38;gt; &#38;#39;def25&#38;#39;,
            &#38;#39;23&#38;#39; =&#38;gt; &#38;#39;xyz23&#38;#39;,
            &#38;#39;21&#38;#39; =&#38;gt; &#38;#39;abc21&#38;#39;,
            &#38;#39;19&#38;#39; =&#38;gt; &#38;#39;def19&#38;#39;,
            &#38;#39;17&#38;#39; =&#38;gt; &#38;#39;xyz17&#38;#39;,
            &#38;#39;15&#38;#39; =&#38;gt; &#38;#39;abc15&#38;#39;,
            &#38;#39;13&#38;#39; =&#38;gt; &#38;#39;def13&#38;#39;,
            &#38;#39;11&#38;#39; =&#38;gt; &#38;#39;zyx11&#38;#39;,
            &#38;#39;9&#38;#39; =&#38;gt; &#38;#39;abc9&#38;#39;

   );

   $discounts = array_flip($codes);

   	if( !empty($coupon) &#38;amp;&#38;amp; in_array($coupon, $codes) )
   	{ 		

		$_POST[&#38;quot;input_3&#38;quot;] = str_replace(&#38;#39;29&#38;#39;, $discounts[$coupon], $_POST[&#38;quot;input_3&#38;quot;]); // update price
		$_POST[&#38;quot;input_2&#38;quot;] = $_POST[&#38;quot;input_7&#38;quot;] * $discounts[$coupon]; // update total
	}

	//var_dump($_POST);
	//exit;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>iamcanadian1973 on "Can&#039;t seem to change $form"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/cant-seem-to-change-form#post-34196</link>
			<pubDate>Fri, 02 Sep 2011 03:32:44 +0000</pubDate>
			<dc:creator>iamcanadian1973</dc:creator>
			<guid isPermaLink="false">34196@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;So I am trying to use a hook to add change the price.&#60;/p&#62;
&#60;p&#62;here is my code&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_pre_submission_filter&#38;quot;, &#38;quot;change_price&#38;quot;);
function change_price($form){

    $price  = $_POST[&#38;quot;input_2&#38;quot;]; //player 1 email

	$coupon = trim( $_POST[&#38;#39;input_6&#38;#39;] );

   $codes = array(

   			&#38;#39;27&#38;#39; =&#38;gt; &#38;#39;abc27&#38;#39;,
            &#38;#39;25&#38;#39; =&#38;gt; &#38;#39;def25&#38;#39;,
            &#38;#39;23&#38;#39; =&#38;gt; &#38;#39;xyz23&#38;#39;,
            &#38;#39;21&#38;#39; =&#38;gt; &#38;#39;abc21&#38;#39;,
            &#38;#39;19&#38;#39; =&#38;gt; &#38;#39;def19&#38;#39;,
            &#38;#39;17&#38;#39; =&#38;gt; &#38;#39;xyz17&#38;#39;,
            &#38;#39;15&#38;#39; =&#38;gt; &#38;#39;abc15&#38;#39;,
            &#38;#39;13&#38;#39; =&#38;gt; &#38;#39;def13&#38;#39;,
            &#38;#39;11&#38;#39; =&#38;gt; &#38;#39;zyx11&#38;#39;,
            &#38;#39;9&#38;#39; =&#38;gt; &#38;#39;abc9&#38;#39;

   );

   $discounts = array_flip($codes);

   	if( !empty($coupon) &#38;amp;&#38;amp; in_array($coupon, $codes) )
   	{
   	 	if( $form[&#38;quot;input_3&#38;quot;] == &#38;#39;Regular&#38;#39;)
		{
			//$form[&#38;quot;input_3&#38;quot;] == &#38;#39;Regular&#124;&#38;#39;.$discounts[$coupon];
		}
		else
		{
			//$form[&#38;quot;input_3&#38;quot;] == &#38;#39;Large&#124;&#38;#39;.$discounts[$coupon];
		}

	}
  	//var_dump($form[&#38;#39;fields&#38;#39;]);

	//echo $form[&#38;#39;fields&#38;#39;][0][&#38;#39;choices&#38;#39;][0][&#38;#39;price&#38;#39;];
	//exit;
    //returning modified form object

    foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field){

		if($field[&#38;quot;id&#38;quot;] == 3){

            $field[&#38;quot;basePrice&#38;quot;] = &#38;#39;$&#38;#39;.$discounts[$coupon];
			$field[&#38;#39;choices&#38;#39;][0][&#38;#39;price&#38;#39;] = &#38;#39;$&#38;#39;.$discounts[$coupon];
			$field[&#38;#39;choices&#38;#39;][1][&#38;#39;price&#38;#39;] = &#38;#39;$&#38;#39;.$discounts[$coupon];

			//echo &#38;quot;yes&#38;quot;;

        }

		//var_dump($field);

		//exit;
	}
	//$form[&#38;#39;fields&#38;#39;][0][&#38;#39;choices&#38;#39;][0][&#38;#39;price&#38;#39;] = &#38;#39;$&#38;#39;.$discounts[$coupon];
	//$form[&#38;#39;fields&#38;#39;][0][&#38;#39;choices&#38;#39;][1][&#38;#39;price&#38;#39;] = &#38;#39;$&#38;#39;.$discounts[$coupon]; 

	//var_dump($form[&#38;#39;fields&#38;#39;]);

	//exit;

    return $form;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;here is the form:&#60;br /&#62;
&#60;a href=&#34;https://www.autoeye.org/test&#34; rel=&#34;nofollow&#34;&#62;https://www.autoeye.org/test&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;If I dump the form variable the values get changed, but now I'm not sure if they are the values I'm supposed to be changing.&#60;br /&#62;
If I just submit the form, it's like nothing happened.&#60;/p&#62;
&#60;p&#62;I have most of it commented out because I'm trying to trouble shoot.&#60;/p&#62;
&#60;p&#62;I don't know where I'm giong wrong. Please help.&#60;/p&#62;
&#60;p&#62;If I for example try the coupon code for $15 it returns this:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;array(11) {
  [0]=&#38;gt;
  array(56) {
    [&#38;quot;adminLabel&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;adminOnly&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;allowsPrepopulate&#38;quot;]=&#38;gt;
    bool(false)
    [&#38;quot;defaultValue&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;description&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;content&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;cssClass&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;errorMessage&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;id&#38;quot;]=&#38;gt;
    int(3)
    [&#38;quot;inputName&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;isRequired&#38;quot;]=&#38;gt;
    bool(true)
    [&#38;quot;label&#38;quot;]=&#38;gt;
    string(11) &#38;quot;Choose Size&#38;quot;
    [&#38;quot;noDuplicates&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;size&#38;quot;]=&#38;gt;
    string(6) &#38;quot;medium&#38;quot;
    [&#38;quot;type&#38;quot;]=&#38;gt;
    string(7) &#38;quot;product&#38;quot;
    [&#38;quot;postCustomFieldName&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;displayAllCategories&#38;quot;]=&#38;gt;
    bool(false)
    [&#38;quot;displayCaption&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;displayDescription&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;displayTitle&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;inputType&#38;quot;]=&#38;gt;
    string(6) &#38;quot;select&#38;quot;
    [&#38;quot;rangeMin&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;rangeMax&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;calendarIconType&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;calendarIconUrl&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;dateType&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;dateFormat&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;phoneFormat&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;addressType&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;defaultCountry&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;defaultProvince&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;defaultState&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;hideAddress2&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;hideCountry&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;hideState&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;inputs&#38;quot;]=&#38;gt;
    NULL
    [&#38;quot;nameFormat&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;allowedExtensions&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;captchaType&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;page_number&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;captchaTheme&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;simpleCaptchaSize&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;simpleCaptchaFontColor&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;simpleCaptchaBackgroundColor&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;failed_validation&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;productField&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;enablePasswordInput&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;maxLength&#38;quot;]=&#38;gt;
    string(0) &#38;quot;&#38;quot;
    [&#38;quot;enablePrice&#38;quot;]=&#38;gt;
    bool(true)
    [&#38;quot;basePrice&#38;quot;]=&#38;gt;
    string(3) &#38;quot;$15&#38;quot;
    [&#38;quot;disableQuantity&#38;quot;]=&#38;gt;
    bool(false)
    [&#38;quot;formId&#38;quot;]=&#38;gt;
    int(1)
    [&#38;quot;pageNumber&#38;quot;]=&#38;gt;
    int(1)
    [&#38;quot;conditionalLogic&#38;quot;]=&#38;gt;
    bool(false)
    [&#38;quot;choices&#38;quot;]=&#38;gt;
    array(2) {
      [0]=&#38;gt;
      array(4) {
        [&#38;quot;text&#38;quot;]=&#38;gt;
        string(18) &#38;quot;Regular 13&#38;quot; x 2.5&#38;quot;&#38;quot;
        [&#38;quot;value&#38;quot;]=&#38;gt;
        string(7) &#38;quot;Regular&#38;quot;
        [&#38;quot;isSelected&#38;quot;]=&#38;gt;
        bool(true)
        [&#38;quot;price&#38;quot;]=&#38;gt;
        string(3) &#38;quot;$15&#38;quot;
      }
      [1]=&#38;gt;
      array(4) {
        [&#38;quot;text&#38;quot;]=&#38;gt;
        string(14) &#38;quot;Large 13&#38;quot; x 4&#38;quot;&#38;quot;
        [&#38;quot;value&#38;quot;]=&#38;gt;
        string(5) &#38;quot;Large&#38;quot;
        [&#38;quot;isSelected&#38;quot;]=&#38;gt;
        bool(false)
        [&#38;quot;price&#38;quot;]=&#38;gt;
        string(3) &#38;quot;$15&#38;quot;
      }
    }
    [&#38;quot;enableChoiceValue&#38;quot;]=&#38;gt;
    bool(true)
  }&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;But does not reflect that in the database or query string.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
