<?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: Update price based on number input field</title>
		<link>https://legacy.forums.gravityhelp.com/topic/update-price-based-on-number-input-field</link>
		<description>Gravity Support Forums Topic: Update price based on number input field</description>
		<language>en-US</language>
		<pubDate>Sat, 11 Apr 2026 21:28:54 +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/update-price-based-on-number-input-field" rel="self" type="application/rss+xml" />

		<item>
			<title>oldtownmarket on "Update price based on number input field"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/update-price-based-on-number-input-field#post-46151</link>
			<pubDate>Wed, 11 Jan 2012 14:28:53 +0000</pubDate>
			<dc:creator>oldtownmarket</dc:creator>
			<guid isPermaLink="false">46151@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thank you for the help! I am needing users to enter prices and then have the total updated at the end with a 20% reduction. I think this will help me out a lot.&#60;br /&#62;
I am extremely new to this and don't know how to get to the bare code of the form. Do you use Dreamweaver or another program to edit your code? &#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
Ryan
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Update price based on number input field"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/update-price-based-on-number-input-field#post-39932</link>
			<pubDate>Thu, 03 Nov 2011 14:57:43 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">39932@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks for sharing jbeim. :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jbeim01 on "Update price based on number input field"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/update-price-based-on-number-input-field#post-39899</link>
			<pubDate>Thu, 03 Nov 2011 13:43:56 +0000</pubDate>
			<dc:creator>jbeim01</dc:creator>
			<guid isPermaLink="false">39899@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I have figured out how to do this and am including my solution in case it benefits anyone else.  To reiterate, this script is placed in the functions.php file and it does the following:&#60;/p&#62;
&#60;p&#62;Users enter a total valuation of property on the form (this is a standard number field).  When this is entered, this script will calculate a &#34;permit fee&#34; (used-defined price field) based on the amount entered.  &#60;/p&#62;
&#60;p&#62;It calculates a state surcharge fee (user-defined price field) which is .0005 times the total valuation of the property.  &#60;/p&#62;
&#60;p&#62;It calculates a plan review fee (user-defined price field) that is a specific percentage of the calculated permit fee based on whether this is a commercial property (65%) or a residential property (35%).  &#60;/p&#62;
&#60;p&#62;Finally, a credit card convenience fee of $3.00 (single product field with price of $3.00 and quantity disabled) is also applied.  The script for this solution can be viewed here: &#60;a href=&#34;http://www.pastie.org/2805522&#34; rel=&#34;nofollow&#34;&#62;http://www.pastie.org/2805522&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jbeim01 on "Update price based on number input field"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/update-price-based-on-number-input-field#post-38655</link>
			<pubDate>Sat, 22 Oct 2011 13:35:04 +0000</pubDate>
			<dc:creator>jbeim01</dc:creator>
			<guid isPermaLink="false">38655@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I have a form which has a number input field that represents the &#34;total market valuation of a property&#34;.  I need to calculate a permit fee which I have defined as a single product (quantity disabled) based on the number that is entered here.  I have tried to follow some of the post examples such as adding tax to the total and others showing how to use the pre_render filter, but I just can't seem to get it to use the value that's entered to update the &#34;price&#34; of my product field (permit fee).  Here's a link to my form: &#60;a href=&#34;http://box731.bluehost.com/~windommn/?page_id=2042&#34; rel=&#34;nofollow&#34;&#62;http://box731.bluehost.com/~windommn/?page_id=2042&#60;/a&#62; and here is the code I added to functions.php:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// update the &#38;quot;29&#38;quot; to the ID of your form
add_filter(&#38;#39;gform_pre_render_29&#38;#39;, &#38;#39;add_total_script&#38;#39;);
function add_total_script($form) {
	$input = &#38;#39;input_66&#38;#39;;
	$valuation += rgpost($input);
   ?&#38;gt;

    &#38;lt;script type=&#38;quot;text/javascript&#38;quot;&#38;gt;
    function gform_product_total(formId, valuation, total){
			var fee = 0;
			if (valuation &#38;lt;= 500){
				fee = 21.00;
			} elseif (valuation &#38;lt;= 2000){
				fee = 21.00 + ((valuation - 500)/100) * 2.75;
			} elseif (valuation &#38;lt;= 25000){
				fee = 62.25 + ((valuation - 2000)/1000) * 12.50;
			} elseif (valuation &#38;lt;= 50000){
				fee = 349.75 + ((valuation - 2000)/1000) * 9.99;
			} elseif (valuation &#38;lt;= 100000){
				fee = 574.75 + ((valuation - 2000)/1000) * 6.25;
			} elseif (valuation &#38;lt;= 500000){
				fee = 887.25 + ((valuation - 2000)/1000) * 5.00;
			} elseif (valuation &#38;lt;= 1000000){
				fee = 2887.25 + ((valuation - 2000)/1000) * 4.25;
			} elseif (valuation &#38;gt; 1000000){
				fee = 5012.25 + ((valuation - 2000)/1000) * 2.75;
			}

        return total + fee;
    }
    &#38;lt;/script&#38;gt;

    &#38;lt;?php
    return $form;
}

// update the &#38;quot;29&#38;quot; to the ID of your form
add_filter(&#38;#39;gform_product_info_29&#38;#39;, &#38;#39;update_product_info&#38;#39;, 10, 3);
function update_product_info($product_info, $form, $entry) {

    $total = get_total($product_info);
	$input = &#38;#39;input_66&#38;#39;;
	$valuation += rgpost($input);
	 $fee = 0;
			if ($valuation &#38;lt;= 500){
				$fee = 21.00;
			} elseif ($valuation &#38;lt;= 2000){
				$fee = 21.00 + (($valuation - 500)/100) * 2.75;
			} elseif ($valuation &#38;lt;= 25000){
				$fee = 62.25 + (($valuation - 2000)/1000) * 12.50;
			} elseif ($valuation &#38;lt;= 50000){
				$fee = 349.75 + (($valuation - 2000)/1000) * 9.99;
			} elseif (valuation &#38;lt;= 100000){
				$fee = 574.75 + (($valuation - 2000)/1000) * 6.25;
			} elseif ($valuation &#38;lt;= 500000){
				$fee = 887.25 + (($valuation - 2000)/1000) * 5.00;
			} elseif (valuation &#38;lt;= 1000000){
				$fee = 2887.25 + (($valuation - 2000)/1000) * 4.25;
			} elseif (valuation &#38;gt; 1000000){
				$fee = 5012.25 + (($valuation - 2000)/1000) * 2.75;
			}

    $product_info[&#38;#39;products&#38;#39;][&#38;#39;permitfee&#38;#39;] = array(
        &#38;#39;name&#38;#39; =&#38;gt; &#38;#39;Permit Fee&#38;#39;, // name that will appear in PayPal and pricing summary tables
        &#38;#39;price&#38;#39; =&#38;gt; $fee, // amount of total tax
        &#38;#39;quantity&#38;#39; =&#38;gt; 1
        );

    return $product_info;
}

function get_total($products) {

    $total = 0;
    foreach($products[&#38;quot;products&#38;quot;] as $product){

        $price = GFCommon::to_number($product[&#38;quot;price&#38;quot;]);
        if(is_array($product[&#38;quot;options&#38;quot;])){
            foreach($product[&#38;quot;options&#38;quot;] as $option){
                $price += GFCommon::to_number($option[&#38;quot;price&#38;quot;]);
            }
        }
        $subtotal = floatval($product[&#38;quot;quantity&#38;quot;]) * $price;
        $total += $subtotal;

    }

    $total += floatval($products[&#38;quot;shipping&#38;quot;][&#38;quot;price&#38;quot;]);

    return $total;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Can anyone help me figure this out?  I've tried so many different things that I feel like I'm running in circles...
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
