<?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: Custom validation issue</title>
		<link>https://legacy.forums.gravityhelp.com/topic/custom-validation-issue</link>
		<description>Gravity Support Forums Topic: Custom validation issue</description>
		<language>en-US</language>
		<pubDate>Tue, 21 Apr 2026 22:04:08 +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/custom-validation-issue" rel="self" type="application/rss+xml" />

		<item>
			<title>David Peralty on "Custom validation issue"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-validation-issue#post-71875</link>
			<pubDate>Tue, 21 Aug 2012 11:03:44 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">71875@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Glad you were able to find a solution. Let us know if anything else comes up. Sometimes, the best thing you can do is take a break from looking at code and tackle it again after a short break. It happens to me all the time when I get too close to a project.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Shelly on "Custom validation issue"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-validation-issue#post-71854</link>
			<pubDate>Tue, 21 Aug 2012 09:31:28 +0000</pubDate>
			<dc:creator>Shelly</dc:creator>
			<guid isPermaLink="false">71854@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Well, I found a better workaround XD  My idiocy is exposed!&#60;/p&#62;
&#60;p&#62;Instead of trying to add a  filter to the &#34;product&#34; pricing field, I simply disabled the &#34;quantity&#34; field in the pricing field option, then added a &#34;quantity&#34; field that goes along with the &#34;product&#34;.  So 2 fields instead of 1, and I can set a minimum quantity on the &#34;quantity&#34; field.&#60;/p&#62;
&#60;p&#62;Well THAT was a whole lot easier than the past 24 hours ;)&#60;/p&#62;
&#60;p&#62;Thanks anyway!  (Maybe that can be a future feature request: to have the ability to set a min/max value on the &#34;product&#34; field when the quantity is displayed, instead of breaking it up into 2 fields?)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Custom validation issue"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-validation-issue#post-71849</link>
			<pubDate>Tue, 21 Aug 2012 09:22:31 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">71849@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Yeah the issue you are experiencing is that the value of money is a string. You would have to convert it to a number and remove the currency symbol and whatnot to do a direct comparison using a greater than or less than operator. I think you can echo a variable and immediately afterwards put exit; and be able to see what is going on.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Shelly on "Custom validation issue"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-validation-issue#post-71844</link>
			<pubDate>Tue, 21 Aug 2012 09:10:21 +0000</pubDate>
			<dc:creator>Shelly</dc:creator>
			<guid isPermaLink="false">71844@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Heh.  Docs to the rescue again - I'm not looking for &#34;gform_field_validation&#34;, I'm looking for &#34;&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_paypal_config_validation&#34; rel=&#34;nofollow&#34;&#62;gform_paypal_config_validation&#60;/a&#62;&#34;.  Looking for the exact code I need to use, but I think I'm starting on the right path here.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Shelly on "Custom validation issue"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-validation-issue#post-71827</link>
			<pubDate>Tue, 21 Aug 2012 08:29:18 +0000</pubDate>
			<dc:creator>Shelly</dc:creator>
			<guid isPermaLink="false">71827@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks David :)&#60;/p&#62;
&#60;p&#62;I just tried your code above, and I'm having the same issue - it's either ALWAYS false, or ALWAYS true depending on which way I put the carat (less than or greater than). &#60;/p&#62;
&#60;p&#62;I'm still messing with the code, but I'm just not seeing why it's not seemingly recognizing the &#34;&#38;lt;&#34; value.  That *seems* to be where the issue lies - in that area somewhere. &#60;/p&#62;
&#60;p&#62;I swear, if I could figure out how to *see* the values returned by $_POST, it would help a lot, but I simply can't get this filter to return the $_POST values to see what, exactly, is being passed (which is usually how I troubleshoot stuff).&#60;/p&#62;
&#60;p&#62;BTW, here's the code I'm using:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_field_validation_1_16&#38;quot;, &#38;quot;custom_validation&#38;quot;, 10, 4); // field 16, form 1
function custom_validation($result, $value, $form, $field){
    	if($result[&#38;quot;is_valid&#38;quot;] &#38;amp;&#38;amp; intval($value) &#38;lt; 15){
        	$result[&#38;quot;is_valid&#38;quot;] = false;
        	$result[&#38;quot;message&#38;quot;] = &#38;quot;A minimum of 15 tickets is required for group pricing.&#38;quot;;
    	}
    return $result;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;pretty much exactly what you wrote.  I just don't get why it's not doing what it *should* be doing.&#60;/p&#62;
&#60;p&#62;EDIT: Okay - I think it has to do with the Paypal add-on.  (This field is a Paypal pricing field.)  When I put in a regular text field and run this function, it works perfectly fine.  But the one I want to use it on is a Paypal quantity field.  Guess I have more digging to do.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Custom validation issue"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-validation-issue#post-71778</link>
			<pubDate>Mon, 20 Aug 2012 20:04:34 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">71778@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi, is there any reason why using the following hook wouldn't work?&#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;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
add_filter(&#38;quot;gform_field_validation_175_1&#38;quot;, &#38;quot;custom_validation&#38;quot;, 10, 4);
function custom_validation($result, $value, $form, $field){

    if($result[&#38;quot;is_valid&#38;quot;] &#38;amp;&#38;amp; intval($value) &#38;lt; 15){
        $result[&#38;quot;is_valid&#38;quot;] = false;
        $result[&#38;quot;message&#38;quot;] = &#38;quot;A minimum of 15 tickets is required for group pricing.&#38;quot;;
    }
    return $result;
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Shelly on "Custom validation issue"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-validation-issue#post-71773</link>
			<pubDate>Mon, 20 Aug 2012 19:27:58 +0000</pubDate>
			<dc:creator>Shelly</dc:creator>
			<guid isPermaLink="false">71773@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hello all,&#60;/p&#62;
&#60;p&#62;I'm having a head-banging issue.  I'm using the following docs on the site:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Using_the_Gravity_Forms_%22gform_validation%22_Hook&#34; rel=&#34;nofollow&#34;&#62;Using the Gform validation hook&#60;/a&#62;&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_validation&#34; rel=&#34;nofollow&#34;&#62;Gform Validation&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;and I'm running into an issue.  Maybe I need another set of eyes or something - because the issue seems like it should be *so simple* to fix, but for the life of me, I can't get it to work.  My filter looks like so:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;#39;gform_validation_1&#38;#39;, &#38;#39;validate_min_group&#38;#39;);
function validate_min_group($validation_result) {

	$form = $validation_result[&#38;quot;form&#38;quot;];
	foreach($form[&#38;#39;fields&#38;#39;] as &#38;amp;$field) {
		if(strpos($field[&#38;#39;cssClass&#38;#39;], &#38;#39;validate-min&#38;#39;) === false) continue;
		$field_value = rgpost(&#38;quot;input_{$field[&#38;#39;id&#38;#39;]}&#38;quot;); // retrieve the value

    	if($field_value &#38;lt; &#38;#39;15&#38;#39;) {   //if the value is less than 15
    		$validation_result[&#38;#39;is_valid&#38;#39;] = false;
    		$field[&#38;#39;failed_validation&#38;#39;] = true;
    		$field[&#38;#39;validation_message&#38;#39;] = &#38;#39;A minimum of 15 tickets is required for group pricing.&#38;#39;;
    	}
	}

    $validation_result[&#38;#39;form&#38;#39;] = $form;
    return $validation_result;

}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;However, no matter what I do, it's absolute: either it ALWAYS returns false, or it ALWAYS returns true.&#60;/p&#62;
&#60;p&#62;It would help if I could print_r() or var_dump the values as they pass, but when I do that, it returns nothing.  (for example, &#60;code&#62;print_r($field_value);&#60;/code&#62; = doesn't come back at all.)  But it just makes no sense at all to me.&#60;/p&#62;
&#60;p&#62;I simply want to check if the field value is less than 15.  if it is, i want it to return my error message.  but like I said, for the life of me, it's absolute.  It wither ALWAYS returns an error, or it NEVER does.&#60;/p&#62;
&#60;p&#62;Can anyone see what I'm doing wrong here?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
