<?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 return product Quantity for validation</title>
		<link>https://legacy.forums.gravityhelp.com/topic/how-to-return-product-quantity-for-validation</link>
		<description>Gravity Support Forums Topic: How-to return product Quantity for validation</description>
		<language>en-US</language>
		<pubDate>Sun, 19 Apr 2026 20:23:17 +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-return-product-quantity-for-validation" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "How-to return product Quantity for validation"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-return-product-quantity-for-validation#post-97610</link>
			<pubDate>Sat, 01 Dec 2012 03:36:10 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">97610@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thank you for sharing your code.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Collectiv on "How-to return product Quantity for validation"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-return-product-quantity-for-validation#post-97374</link>
			<pubDate>Fri, 30 Nov 2012 14:58:36 +0000</pubDate>
			<dc:creator>Collectiv</dc:creator>
			<guid isPermaLink="false">97374@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks. Thats how I did it finaly. &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_field_validation_1_15&#38;quot;, &#38;quot;validate_list_field&#38;quot;, 10, 4);
function validate_list_field($result, $value, $form, $field){

    $product_qty = rgpost(&#38;#39;input_33&#38;#39;);

    // Test if equal quantity
    if( count($current_emails) != $product_qty ){
        $result[&#38;quot;is_valid&#38;quot;] = false;
        $result[&#38;quot;message&#38;quot;] .= sprintf(__(&#38;#39;&#38;lt;br/&#38;gt;Vous devez inscrire (%d) personnes dans votre équipe.&#38;#39;,&#38;#39;nsec&#38;#39;), $product_qty);
    }

    // always return result
    return $result;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>David Peralty on "How-to return product Quantity for validation"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-return-product-quantity-for-validation#post-94884</link>
			<pubDate>Fri, 23 Nov 2012 16:05:39 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">94884@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;So I don't think you can use pre_render to take something from one section of a form and populate another. Because when pre_render has run, no one has typed anything in yet. &#60;/p&#62;
&#60;p&#62;Have you looked at this:&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_post_paging&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_post_paging&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Collectiv on "How-to return product Quantity for validation"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-return-product-quantity-for-validation#post-94880</link>
			<pubDate>Fri, 23 Nov 2012 15:31:22 +0000</pubDate>
			<dc:creator>Collectiv</dc:creator>
			<guid isPermaLink="false">94880@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I would really appreciate some help on this one. &#60;/p&#62;
&#60;p&#62;All I need to do is to populate a list field with a qty collected in the first step.&#60;br /&#62;
Here is the code: &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// Populate list with selected quantity
add_filter(&#38;quot;gform_pre_render_1&#38;quot;, &#38;quot;pre_populate_row_list&#38;quot;);
function pre_populate_row_list($form){

	$field_id = 15; // Member list
	$product_qty = rgpost(&#38;#39;input_30&#38;#39;);
	$list = rgpost(&#38;#39;input_15&#38;#39;);

	$current_page = GFFormDisplay::get_current_page($form[&#38;quot;id&#38;quot;]);

	//if($current_page == 2){
		foreach($form[&#38;#39;fields&#38;#39;] as &#38;amp;$field){
			if($field[&#38;#39;id&#38;#39;] != $field_id)
				continue;	

			// Dynamic Population doesn&#38;#39;t work :\
			$array = array_fill(0, $product_qty ,&#38;#39;&#38;#39;);
			$field[&#38;#39;choices&#38;#39;] = array_fill(0, 2, $array);
			//$field[&#38;#39;label&#38;#39;] = implode(&#38;#39;,&#38;#39;,$field[&#38;#39;choices&#38;#39;]);
		}
	//}
	return $form;
}&#60;/code&#62;&#60;/pre&#62;
 
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Collectiv on "How-to return product Quantity for validation"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-return-product-quantity-for-validation#post-94511</link>
			<pubDate>Thu, 22 Nov 2012 17:09:39 +0000</pubDate>
			<dc:creator>Collectiv</dc:creator>
			<guid isPermaLink="false">94511@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I would like to test if my list field rows == product quantity in the second step.&#60;br /&#62;
Since the quantity field is in the step 1, it is not validated on step 2&#60;/p&#62;
&#60;p&#62;The quantity would be use to populate the field list with the required rows.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "How-to return product Quantity for validation"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-return-product-quantity-for-validation#post-94495</link>
			<pubDate>Thu, 22 Nov 2012 15:08:00 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">94495@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Have you tried the following?&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_field_validation&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_field_validation&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Collectiv on "How-to return product Quantity for validation"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-return-product-quantity-for-validation#post-94492</link>
			<pubDate>Thu, 22 Nov 2012 14:58:01 +0000</pubDate>
			<dc:creator>Collectiv</dc:creator>
			<guid isPermaLink="false">94492@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I'm triying to return the value for the product qty.&#60;br /&#62;
I need to validate qty field. It should be trivial no?&#60;/p&#62;
&#60;p&#62;Check this out: &#60;a href=&#34;http://projets.collectiv.ca/northsec-2013/&#34; rel=&#34;nofollow&#34;&#62;http://projets.collectiv.ca/northsec-2013/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Something like this maybe ...&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.gravityhelp.com/documentation/index.php?title=Gravity_Forms_Pricing:_Adding_Tax&#38;amp;oldid=1514&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/index.php?title=Gravity_Forms_Pricing:_Adding_Tax&#38;amp;oldid=1514&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;But in gform_field_validation hook.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "How-to return product Quantity for validation"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-return-product-quantity-for-validation#post-94490</link>
			<pubDate>Thu, 22 Nov 2012 14:37:58 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">94490@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Can you give me more information on what you are trying to do? I don't understand.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Collectiv on "How-to return product Quantity for validation"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-return-product-quantity-for-validation#post-94489</link>
			<pubDate>Thu, 22 Nov 2012 14:37:23 +0000</pubDate>
			<dc:creator>Collectiv</dc:creator>
			<guid isPermaLink="false">94489@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;How do we return product quantity in gform_hooks ?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
